MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / test_reads

Function test_reads

tests/bytes.cc:60–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60static void test_reads()
61{
62 Bytes b = {1, 2, 3, 4};
63 ByteReader br(b);
64
65 br.seek(0);
66 assert(br.read_be16() == 0x0102);
67 assert(br.read_le16() == 0x0403);
68
69 br.seek(0);
70 assert(br.read_8() == 0x01);
71 assert(br.read_8() == 0x02);
72
73 // clang-format off
74 br.seek(0); assert(br.read_be24() == 0x010203);
75 br.seek(0); assert(br.read_le24() == 0x030201);
76 br.seek(0); assert(br.read_be32() == 0x01020304);
77 br.seek(0); assert(br.read_le32() == 0x04030201);
78 // clang-format on
79}
80
81static void test_writes()
82{

Callers 1

mainFunction · 0.85

Calls 8

read_be16Method · 0.80
read_le16Method · 0.80
read_8Method · 0.80
read_be24Method · 0.80
read_le24Method · 0.80
read_be32Method · 0.80
read_le32Method · 0.80
seekMethod · 0.45

Tested by

no test coverage detected