Add test library with common primitives for tests

Change-Id: I343c6c9ec3f7a97964fa6089652d0b7d7515956f
Fix memory leak decoding Segment types

Change-Id: I9fa68a25362f41754a6dd32f4f13bf66ce46b2e0
Add tests for segment events

Change-Id: I6447780e6175f5a5285714f7f4e1acd2658b97ea
Fix format

Change-Id: Ic1a3a2d5a1742ff9c9361435def4ee7c1ef2ddd6