Branch Coverage

t/varint.cc
Criterion Covered Total %
branch 102 314 32.4


line true false branch
7 1 0 CHECK(varint_encode(0) == string("\0"));
1 0 CHECK(varint_encode(0) == string("\0"));
1 0 CHECK(varint_encode(0) == string("\0"));
1 0 CHECK(varint_encode(0) == string("\0"));
1 0 CHECK(varint_encode(0) == string("\0"));
1 0 CHECK(varint_encode(0) == string("\0"));
0 0 CHECK(varint_encode(0) == string("\0"));
0 0 CHECK(varint_encode(0) == string("\0"));
8 1 0 CHECK(varint_encode(1) == string("\1"));
1 0 CHECK(varint_encode(1) == string("\1"));
1 0 CHECK(varint_encode(1) == string("\1"));
1 0 CHECK(varint_encode(1) == string("\1"));
1 0 CHECK(varint_encode(1) == string("\1"));
1 0 CHECK(varint_encode(1) == string("\1"));
0 0 CHECK(varint_encode(1) == string("\1"));
0 0 CHECK(varint_encode(1) == string("\1"));
9 1 0 CHECK(varint_encode(127) == string("\x7f"));
1 0 CHECK(varint_encode(127) == string("\x7f"));
1 0 CHECK(varint_encode(127) == string("\x7f"));
1 0 CHECK(varint_encode(127) == string("\x7f"));
1 0 CHECK(varint_encode(127) == string("\x7f"));
1 0 CHECK(varint_encode(127) == string("\x7f"));
0 0 CHECK(varint_encode(127) == string("\x7f"));
0 0 CHECK(varint_encode(127) == string("\x7f"));
11 1 0 CHECK(varint_encode(128) == string("\x80\1"));
1 0 CHECK(varint_encode(128) == string("\x80\1"));
1 0 CHECK(varint_encode(128) == string("\x80\1"));
1 0 CHECK(varint_encode(128) == string("\x80\1"));
1 0 CHECK(varint_encode(128) == string("\x80\1"));
1 0 CHECK(varint_encode(128) == string("\x80\1"));
0 0 CHECK(varint_encode(128) == string("\x80\1"));
0 0 CHECK(varint_encode(128) == string("\x80\1"));
12 1 0 CHECK(varint_encode(129) == string("\x81\1"));
1 0 CHECK(varint_encode(129) == string("\x81\1"));
1 0 CHECK(varint_encode(129) == string("\x81\1"));
1 0 CHECK(varint_encode(129) == string("\x81\1"));
1 0 CHECK(varint_encode(129) == string("\x81\1"));
1 0 CHECK(varint_encode(129) == string("\x81\1"));
0 0 CHECK(varint_encode(129) == string("\x81\1"));
0 0 CHECK(varint_encode(129) == string("\x81\1"));
16 1 0 CHECK(varint_decode(string("\0")) == 0);
1 0 CHECK(varint_decode(string("\0")) == 0);
1 0 CHECK(varint_decode(string("\0")) == 0);
1 0 CHECK(varint_decode(string("\0")) == 0);
1 0 CHECK(varint_decode(string("\0")) == 0);
1 0 CHECK(varint_decode(string("\0")) == 0);
0 0 CHECK(varint_decode(string("\0")) == 0);
0 0 CHECK(varint_decode(string("\0")) == 0);
17 1 0 CHECK(varint_decode(string("\1")) == 1);
1 0 CHECK(varint_decode(string("\1")) == 1);
1 0 CHECK(varint_decode(string("\1")) == 1);
1 0 CHECK(varint_decode(string("\1")) == 1);
1 0 CHECK(varint_decode(string("\1")) == 1);
1 0 CHECK(varint_decode(string("\1")) == 1);
0 0 CHECK(varint_decode(string("\1")) == 1);
0 0 CHECK(varint_decode(string("\1")) == 1);
18 1 0 CHECK(varint_decode(string("\x7f")) == 127);
1 0 CHECK(varint_decode(string("\x7f")) == 127);
1 0 CHECK(varint_decode(string("\x7f")) == 127);
1 0 CHECK(varint_decode(string("\x7f")) == 127);
1 0 CHECK(varint_decode(string("\x7f")) == 127);
1 0 CHECK(varint_decode(string("\x7f")) == 127);
0 0 CHECK(varint_decode(string("\x7f")) == 127);
0 0 CHECK(varint_decode(string("\x7f")) == 127);
20 1 0 CHECK(varint_decode(string("\x80\1")) == 128);
1 0 CHECK(varint_decode(string("\x80\1")) == 128);
1 0 CHECK(varint_decode(string("\x80\1")) == 128);
1 0 CHECK(varint_decode(string("\x80\1")) == 128);
1 0 CHECK(varint_decode(string("\x80\1")) == 128);
1 0 CHECK(varint_decode(string("\x80\1")) == 128);
0 0 CHECK(varint_decode(string("\x80\1")) == 128);
0 0 CHECK(varint_decode(string("\x80\1")) == 128);
21 1 0 CHECK(varint_decode(string("\x81\1")) == 129);
1 0 CHECK(varint_decode(string("\x81\1")) == 129);
1 0 CHECK(varint_decode(string("\x81\1")) == 129);
1 0 CHECK(varint_decode(string("\x81\1")) == 129);
1 0 CHECK(varint_decode(string("\x81\1")) == 129);
1 0 CHECK(varint_decode(string("\x81\1")) == 129);
0 0 CHECK(varint_decode(string("\x81\1")) == 129);
0 0 CHECK(varint_decode(string("\x81\1")) == 129);
25 256 1 for (uint32_t i = 0; i < 256; ++i) {
26 256 0 if (varint_decode(varint_encode(i)) != i) {
256 0 if (varint_decode(varint_encode(i)) != i) {
0 256 if (varint_decode(varint_encode(i)) != i) {
27 0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
30 17242 1 for (uint32_t i = 0; i < 500000; i+=29) {
31 17242 0 if (varint_decode(varint_encode(i)) != i) {
17242 0 if (varint_decode(varint_encode(i)) != i) {
0 17242 if (varint_decode(varint_encode(i)) != i) {
32 0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
35 1 0 REQUIRE(true);
1 0 REQUIRE(true);
1 0 REQUIRE(true);
1 0 REQUIRE(true);
0 0 REQUIRE(true);
0 0 REQUIRE(true);
39 0 1 for (int i = 256; i < 256; ++i) {
40 0 0 if (varint_decode_s(varint_encode_s(i)) != i) {
0 0 if (varint_decode_s(varint_encode_s(i)) != i) {
0 0 if (varint_decode_s(varint_encode_s(i)) != i) {
41 0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
44 34483 1 for (int i = -500000; i < 500000; i+=29) {
45 34483 0 int res = varint_decode_s(varint_encode_s(i));
34483 0 int res = varint_decode_s(varint_encode_s(i));
46 0 34483 if (res != i) {
47 0 0 INFO(res);
0 0 INFO(res);
0 0 INFO(res);
48 0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
0 0 FAIL(i);
51 1 0 REQUIRE(true);
1 0 REQUIRE(true);
1 0 REQUIRE(true);
1 0 REQUIRE(true);
0 0 REQUIRE(true);
0 0 REQUIRE(true);
55 1 0 VarIntStack stack;
56 1 0 stack.push(300);
57 1 0 stack.push(400);
58 1 0 CHECK(stack.top() == 400);
1 0 CHECK(stack.top() == 400);
1 0 CHECK(stack.top() == 400);
1 0 CHECK(stack.top() == 400);
1 0 CHECK(stack.top() == 400);
1 0 CHECK(stack.top() == 400);
0 0 CHECK(stack.top() == 400);
0 0 CHECK(stack.top() == 400);
59 1 0 stack.pop();
60 1 0 CHECK(stack.top() == 300);
1 0 CHECK(stack.top() == 300);
1 0 CHECK(stack.top() == 300);
1 0 CHECK(stack.top() == 300);
1 0 CHECK(stack.top() == 300);
1 0 CHECK(stack.top() == 300);
0 0 CHECK(stack.top() == 300);
0 0 CHECK(stack.top() == 300);
61 18 0 }
18 0 }