MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / TEST

Function TEST

source/test/byte_array_test.cpp:8–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6using namespace Star;
7
8TEST(ByteArrayTest, All) {
9 auto res = ByteArray::fromCString("foobar");
10 res.insert(2, 'a');
11 res.insert(6, 'b');
12 res.push_back('c');
13 res.insert(9, 'd');
14 EXPECT_EQ(res, ByteArray::fromCString("foaobabrcd"));
15
16 auto a = hexDecode("0a0a0a");
17 auto b = hexDecode("a0a0a0");
18 auto c = hexDecode("818181");
19 auto d = hexDecode("aaaaaa");
20 auto e = hexDecode("000000");
21 auto f = hexDecode("212121");
22
23 auto g = hexDecode("a0a0a0");
24 auto h = hexDecode("8181818181");
25 auto i = hexDecode("2121218181");
26
27 EXPECT_EQ(a.andWith(b), e);
28 EXPECT_EQ(a.orWith(b), d);
29 EXPECT_EQ(b.xorWith(c), f);
30 EXPECT_EQ(g.xorWith(h), f);
31 EXPECT_EQ(g.xorWith(h, true), i);
32 EXPECT_EQ(h.xorWith(g, true), i);
33}

Callers

nothing calls this directly

Calls 6

hexDecodeFunction · 0.85
andWithMethod · 0.80
orWithMethod · 0.80
xorWithMethod · 0.80
insertMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected