[test] Make CHECK_EQ calls in cctest consistent.

Cleanup CHECK_EQ order and simplify CHECK_EQ(true/false).
Cleanup callorder for negative numbers
Cleanup callorder order for capital letter constants.
Cleanup callorder for test.x checks.

BUG=

Review-Url: https://codereview.chromium.org/2677183002
Cr-Commit-Position: refs/heads/master@{#42997}
This commit is contained in:
franzih 2017-02-07 06:20:02 -08:00 committed by Commit bot
parent 9e7d5a6065
commit 3df821c24e
15 changed files with 173 additions and 175 deletions

View File

@ -154,8 +154,8 @@ THREADED_TEST(GlobalVariableAccess) {
v8::External::New(isolate, &baz));
LocalContext env(0, templ->InstanceTemplate());
v8_compile("foo = (++bar) + baz")->Run(env.local()).ToLocalChecked();
CHECK_EQ(bar, -3);
CHECK_EQ(foo, 7);
CHECK_EQ(-3, bar);
CHECK_EQ(7, foo);
}

View File

@ -1535,7 +1535,7 @@ TEST(Regress621926) {
#endif
F0 f = FUNCTION_CAST<F0>(code->entry());
CHECK_EQ(f(), 1);
CHECK_EQ(1, f());
}
#undef __

View File

@ -1406,10 +1406,10 @@ TEST(seleqz_selnez) {
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(test.a, 1);
CHECK_EQ(test.b, 0);
CHECK_EQ(test.c, 0);
CHECK_EQ(test.d, 1);
CHECK_EQ(1, test.a);
CHECK_EQ(0, test.b);
CHECK_EQ(0, test.c);
CHECK_EQ(1, test.d);
const int test_size = 3;
const int input_size = 5;
@ -1433,18 +1433,18 @@ TEST(seleqz_selnez) {
test.i = inputs_S[i];
test.j = tests_S[j];
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(test.g, outputs_D[i]);
CHECK_EQ(test.h, 0);
CHECK_EQ(test.k, outputs_S[i]);
CHECK_EQ(test.l, 0);
CHECK_EQ(outputs_D[i], test.g);
CHECK_EQ(0, test.h);
CHECK_EQ(outputs_S[i], test.k);
CHECK_EQ(0, test.l);
test.f = tests_D[j+1];
test.j = tests_S[j+1];
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(test.g, 0);
CHECK_EQ(test.h, outputs_D[i]);
CHECK_EQ(test.k, 0);
CHECK_EQ(test.l, outputs_S[i]);
CHECK_EQ(0, test.g);
CHECK_EQ(outputs_D[i], test.h);
CHECK_EQ(0, test.k);
CHECK_EQ(outputs_S[i], test.l);
}
}
}
@ -3191,7 +3191,7 @@ TEST(jump_tables1) {
__ jr(ra);
__ nop();
CHECK_EQ(assm.UnboundLabelsCount(), 0);
CHECK_EQ(0, assm.UnboundLabelsCount());
CodeDesc desc;
assm.GetCode(&desc);
@ -3670,14 +3670,14 @@ TEST(ABS) {
test.a = std::numeric_limits<double>::quiet_NaN();
test.b = std::numeric_limits<float>::quiet_NaN();
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(std::isnan(test.a), true);
CHECK_EQ(std::isnan(test.b), true);
CHECK(std::isnan(test.a));
CHECK(std::isnan(test.b));
test.a = std::numeric_limits<double>::signaling_NaN();
test.b = std::numeric_limits<float>::signaling_NaN();
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(std::isnan(test.a), true);
CHECK_EQ(std::isnan(test.b), true);
CHECK(std::isnan(test.a));
CHECK(std::isnan(test.b));
}
@ -3737,16 +3737,16 @@ TEST(ADD_FMT) {
test.fa = std::numeric_limits<float>::max();
test.fb = std::numeric_limits<float>::max();
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(std::isfinite(test.c), false);
CHECK_EQ(std::isfinite(test.fc), false);
CHECK(!std::isfinite(test.c));
CHECK(!std::isfinite(test.fc));
test.a = 5.0;
test.b = std::numeric_limits<double>::signaling_NaN();
test.fa = 5.0;
test.fb = std::numeric_limits<float>::signaling_NaN();
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(std::isnan(test.c), true);
CHECK_EQ(std::isnan(test.fc), true);
CHECK(std::isnan(test.c));
CHECK(std::isnan(test.fc));
}
@ -4278,8 +4278,8 @@ TEST(CVT) {
CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in));
}
if (IsFp64Mode()) {
CHECK_EQ(test.cvt_l_s_out, -1);
CHECK_EQ(test.cvt_l_d_out, -1);
CHECK_EQ(-1, test.cvt_l_s_out);
CHECK_EQ(-1, test.cvt_l_d_out);
}
CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in));
CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in));
@ -4287,9 +4287,8 @@ TEST(CVT) {
IsFp64Mode()) {
CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in));
}
CHECK_EQ(test.cvt_w_s_out, -1);
CHECK_EQ(test.cvt_w_d_out, -1);
CHECK_EQ(-1, test.cvt_w_s_out);
CHECK_EQ(-1, test.cvt_w_d_out);
test.cvt_d_s_in = 0.49;
test.cvt_d_w_in = 1;
@ -4310,8 +4309,8 @@ TEST(CVT) {
CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in));
}
if (IsFp64Mode()) {
CHECK_EQ(test.cvt_l_s_out, 0);
CHECK_EQ(test.cvt_l_d_out, 0);
CHECK_EQ(0, test.cvt_l_s_out);
CHECK_EQ(0, test.cvt_l_d_out);
}
CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in));
CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in));
@ -4319,8 +4318,8 @@ TEST(CVT) {
IsFp64Mode()) {
CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in));
}
CHECK_EQ(test.cvt_w_s_out, 0);
CHECK_EQ(test.cvt_w_d_out, 0);
CHECK_EQ(0, test.cvt_w_s_out);
CHECK_EQ(0, test.cvt_w_d_out);
test.cvt_d_s_in = std::numeric_limits<float>::max();
test.cvt_d_w_in = std::numeric_limits<int32_t>::max();
@ -4412,8 +4411,8 @@ TEST(CVT) {
CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in));
}
if (IsFp64Mode()) {
CHECK_EQ(test.cvt_l_s_out, 0);
CHECK_EQ(test.cvt_l_d_out, 0);
CHECK_EQ(0, test.cvt_l_s_out);
CHECK_EQ(0, test.cvt_l_d_out);
}
CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in));
CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in));
@ -4421,8 +4420,8 @@ TEST(CVT) {
IsFp64Mode()) {
CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in));
}
CHECK_EQ(test.cvt_w_s_out, 0);
CHECK_EQ(test.cvt_w_d_out, 0);
CHECK_EQ(0, test.cvt_w_s_out);
CHECK_EQ(0, test.cvt_w_d_out);
}
@ -4525,8 +4524,8 @@ TEST(DIV_FMT) {
test.fOp2 = -0.0;
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(false, std::isfinite(test.dRes));
CHECK_EQ(false, std::isfinite(test.fRes));
CHECK(!std::isfinite(test.dRes));
CHECK(!std::isfinite(test.fRes));
test.dOp1 = 0.0;
test.dOp2 = -0.0;
@ -4534,8 +4533,8 @@ TEST(DIV_FMT) {
test.fOp2 = -0.0;
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(true, std::isnan(test.dRes));
CHECK_EQ(true, std::isnan(test.fRes));
CHECK(std::isnan(test.dRes));
CHECK(std::isnan(test.fRes));
test.dOp1 = std::numeric_limits<double>::quiet_NaN();
test.dOp2 = -5.0;
@ -4543,8 +4542,8 @@ TEST(DIV_FMT) {
test.fOp2 = -5.0;
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(true, std::isnan(test.dRes));
CHECK_EQ(true, std::isnan(test.fRes));
CHECK(std::isnan(test.dRes));
CHECK(std::isnan(test.fRes));
}
@ -5383,7 +5382,7 @@ TEST(Trampoline) {
int32_t res = reinterpret_cast<int32_t>(
CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
CHECK_EQ(res, 0);
CHECK_EQ(0, res);
}
template <class T>

View File

@ -1589,10 +1589,10 @@ TEST(seleqz_selnez) {
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(test.a, 1);
CHECK_EQ(test.b, 0);
CHECK_EQ(test.c, 0);
CHECK_EQ(test.d, 1);
CHECK_EQ(1, test.a);
CHECK_EQ(0, test.b);
CHECK_EQ(0, test.c);
CHECK_EQ(1, test.d);
const int test_size = 3;
const int input_size = 5;
@ -1616,18 +1616,18 @@ TEST(seleqz_selnez) {
test.i = inputs_S[i];
test.j = tests_S[j];
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(test.g, outputs_D[i]);
CHECK_EQ(test.h, 0);
CHECK_EQ(test.k, outputs_S[i]);
CHECK_EQ(test.l, 0);
CHECK_EQ(outputs_D[i], test.g);
CHECK_EQ(0, test.h);
CHECK_EQ(outputs_S[i], test.k);
CHECK_EQ(0, test.l);
test.f = tests_D[j+1];
test.j = tests_S[j+1];
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(test.g, 0);
CHECK_EQ(test.h, outputs_D[i]);
CHECK_EQ(test.k, 0);
CHECK_EQ(test.l, outputs_S[i]);
CHECK_EQ(0, test.g);
CHECK_EQ(outputs_D[i], test.h);
CHECK_EQ(0, test.k);
CHECK_EQ(outputs_S[i], test.l);
}
}
}
@ -3315,7 +3315,7 @@ TEST(jump_tables1) {
__ jr(ra);
__ nop();
CHECK_EQ(assm.UnboundLabelsCount(), 0);
CHECK_EQ(0, assm.UnboundLabelsCount());
CodeDesc desc;
assm.GetCode(&desc);
@ -3829,14 +3829,14 @@ TEST(ABS) {
test.a = std::numeric_limits<double>::quiet_NaN();
test.b = std::numeric_limits<float>::quiet_NaN();
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(std::isnan(test.a), true);
CHECK_EQ(std::isnan(test.b), true);
CHECK(std::isnan(test.a));
CHECK(std::isnan(test.b));
test.a = std::numeric_limits<double>::signaling_NaN();
test.b = std::numeric_limits<float>::signaling_NaN();
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(std::isnan(test.a), true);
CHECK_EQ(std::isnan(test.b), true);
CHECK(std::isnan(test.a));
CHECK(std::isnan(test.b));
}
@ -3896,16 +3896,16 @@ TEST(ADD_FMT) {
test.fa = std::numeric_limits<float>::max();
test.fb = std::numeric_limits<float>::max();
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(std::isfinite(test.c), false);
CHECK_EQ(std::isfinite(test.fc), false);
CHECK(!std::isfinite(test.c));
CHECK(!std::isfinite(test.fc));
test.a = 5.0;
test.b = std::numeric_limits<double>::signaling_NaN();
test.fa = 5.0;
test.fb = std::numeric_limits<float>::signaling_NaN();
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(std::isnan(test.c), true);
CHECK_EQ(std::isnan(test.fc), true);
CHECK(std::isnan(test.c));
CHECK(std::isnan(test.fc));
}
@ -4425,14 +4425,13 @@ TEST(CVT) {
CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in));
CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in));
CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in));
CHECK_EQ(test.cvt_l_s_out, -1);
CHECK_EQ(test.cvt_l_d_out, -1);
CHECK_EQ(-1, test.cvt_l_s_out);
CHECK_EQ(-1, test.cvt_l_d_out);
CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in));
CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in));
CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in));
CHECK_EQ(test.cvt_w_s_out, -1);
CHECK_EQ(test.cvt_w_d_out, -1);
CHECK_EQ(-1, test.cvt_w_s_out);
CHECK_EQ(-1, test.cvt_w_d_out);
test.cvt_d_s_in = 0.49;
test.cvt_d_w_in = 1;
@ -4449,13 +4448,13 @@ TEST(CVT) {
CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in));
CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in));
CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in));
CHECK_EQ(test.cvt_l_s_out, 0);
CHECK_EQ(test.cvt_l_d_out, 0);
CHECK_EQ(0, test.cvt_l_s_out);
CHECK_EQ(0, test.cvt_l_d_out);
CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in));
CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in));
CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in));
CHECK_EQ(test.cvt_w_s_out, 0);
CHECK_EQ(test.cvt_w_d_out, 0);
CHECK_EQ(0, test.cvt_w_s_out);
CHECK_EQ(0, test.cvt_w_d_out);
test.cvt_d_s_in = std::numeric_limits<float>::max();
test.cvt_d_w_in = std::numeric_limits<int32_t>::max();
@ -4527,13 +4526,13 @@ TEST(CVT) {
CHECK_EQ(test.cvt_d_s_out, static_cast<double>(test.cvt_d_s_in));
CHECK_EQ(test.cvt_d_w_out, static_cast<double>(test.cvt_d_w_in));
CHECK_EQ(test.cvt_d_l_out, static_cast<double>(test.cvt_d_l_in));
CHECK_EQ(test.cvt_l_s_out, 0);
CHECK_EQ(test.cvt_l_d_out, 0);
CHECK_EQ(0, test.cvt_l_s_out);
CHECK_EQ(0, test.cvt_l_d_out);
CHECK_EQ(test.cvt_s_d_out, static_cast<float>(test.cvt_s_d_in));
CHECK_EQ(test.cvt_s_w_out, static_cast<float>(test.cvt_s_w_in));
CHECK_EQ(test.cvt_s_l_out, static_cast<float>(test.cvt_s_l_in));
CHECK_EQ(test.cvt_w_s_out, 0);
CHECK_EQ(test.cvt_w_d_out, 0);
CHECK_EQ(0, test.cvt_w_s_out);
CHECK_EQ(0, test.cvt_w_d_out);
}
@ -4634,8 +4633,8 @@ TEST(DIV_FMT) {
test.fOp2 = -0.0;
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(false, std::isfinite(test.dRes));
CHECK_EQ(false, std::isfinite(test.fRes));
CHECK(!std::isfinite(test.dRes));
CHECK(!std::isfinite(test.fRes));
test.dOp1 = 0.0;
test.dOp2 = -0.0;
@ -4643,8 +4642,8 @@ TEST(DIV_FMT) {
test.fOp2 = -0.0;
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(true, std::isnan(test.dRes));
CHECK_EQ(true, std::isnan(test.fRes));
CHECK(std::isnan(test.dRes));
CHECK(std::isnan(test.fRes));
test.dOp1 = std::numeric_limits<double>::quiet_NaN();
test.dOp2 = -5.0;
@ -4652,8 +4651,8 @@ TEST(DIV_FMT) {
test.fOp2 = -5.0;
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
CHECK_EQ(true, std::isnan(test.dRes));
CHECK_EQ(true, std::isnan(test.fRes));
CHECK(std::isnan(test.dRes));
CHECK(std::isnan(test.fRes));
}
@ -5931,7 +5930,7 @@ TEST(Trampoline) {
int64_t res = reinterpret_cast<int64_t>(
CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
CHECK_EQ(res, 0);
CHECK_EQ(0, res);
}
template <class T>

View File

@ -445,7 +445,7 @@ TEST(Regress621926) {
#endif
F0 f = FUNCTION_CAST<F0>(code->entry());
CHECK_EQ(f(), 1);
CHECK_EQ(1, f());
}
#undef __

View File

@ -42,7 +42,7 @@ TEST(CodeLayoutWithoutUnwindingInfo) {
CHECK(!code->has_unwinding_info());
CHECK_EQ(code->instruction_size(), buffer_size);
CHECK_EQ(memcmp(code->instruction_start(), buffer, buffer_size), 0);
CHECK_EQ(0, memcmp(code->instruction_start(), buffer, buffer_size));
CHECK_EQ(code->instruction_end() - reinterpret_cast<byte*>(*code),
Code::kHeaderSize + buffer_size - kHeapObjectTag);
}
@ -79,7 +79,7 @@ TEST(CodeLayoutWithUnwindingInfo) {
CHECK(code->has_unwinding_info());
CHECK_EQ(code->instruction_size(), buffer_size);
CHECK_EQ(memcmp(code->instruction_start(), buffer, buffer_size), 0);
CHECK_EQ(0, memcmp(code->instruction_start(), buffer, buffer_size));
CHECK(IsAligned(code->GetUnwindingInfoSizeOffset(), 8));
CHECK_EQ(code->unwinding_info_size(), unwinding_info_size);
CHECK(

View File

@ -1579,7 +1579,7 @@ TEST(IsDebugActive) {
CHECK(!code.is_null());
FunctionTester ft(code, kNumParams);
CHECK_EQ(false, isolate->debug()->is_active());
CHECK(!isolate->debug()->is_active());
Handle<Object> result =
ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
CHECK_EQ(isolate->heap()->false_value(), *result);

View File

@ -6629,7 +6629,7 @@ TEST(DebugStepOverFunctionWithCaughtException) {
"foo();\n");
v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
CHECK_EQ(break_point_hit_count, 4);
CHECK_EQ(4, break_point_hit_count);
}
bool out_of_memory_callback_called = false;

View File

@ -50,27 +50,27 @@ static void TestHashMap(Handle<HashMap> table) {
Handle<JSObject> a = factory->NewJSArray(7);
Handle<JSObject> b = factory->NewJSArray(11);
table = HashMap::Put(table, a, b);
CHECK_EQ(table->NumberOfElements(), 1);
CHECK_EQ(1, table->NumberOfElements());
CHECK_EQ(table->Lookup(a), *b);
// When the key does not exist in the map, Lookup returns the hole.
CHECK_EQ(table->Lookup(b), CcTest::heap()->the_hole_value());
// Keys still have to be valid after objects were moved.
CcTest::CollectGarbage(NEW_SPACE);
CHECK_EQ(table->NumberOfElements(), 1);
CHECK_EQ(1, table->NumberOfElements());
CHECK_EQ(table->Lookup(a), *b);
CHECK_EQ(table->Lookup(b), CcTest::heap()->the_hole_value());
// Keys that are overwritten should not change number of elements.
table = HashMap::Put(table, a, factory->NewJSArray(13));
CHECK_EQ(table->NumberOfElements(), 1);
CHECK_EQ(1, table->NumberOfElements());
CHECK_NE(table->Lookup(a), *b);
// Keys that have been removed are mapped to the hole.
bool was_present = false;
table = HashMap::Remove(table, a, &was_present);
CHECK(was_present);
CHECK_EQ(table->NumberOfElements(), 0);
CHECK_EQ(0, table->NumberOfElements());
CHECK_EQ(table->Lookup(a), CcTest::heap()->the_hole_value());
// Keys should map back to their respective values and also should get
@ -121,19 +121,19 @@ static void TestHashSet(Handle<HashSet> table) {
Handle<JSObject> a = factory->NewJSArray(7);
Handle<JSObject> b = factory->NewJSArray(11);
table = HashSet::Add(table, a);
CHECK_EQ(table->NumberOfElements(), 1);
CHECK_EQ(1, table->NumberOfElements());
CHECK(table->Has(isolate, a));
CHECK(!table->Has(isolate, b));
// Keys still have to be valid after objects were moved.
CcTest::CollectGarbage(NEW_SPACE);
CHECK_EQ(table->NumberOfElements(), 1);
CHECK_EQ(1, table->NumberOfElements());
CHECK(table->Has(isolate, a));
CHECK(!table->Has(isolate, b));
// Keys that are overwritten should not change number of elements.
table = HashSet::Add(table, a);
CHECK_EQ(table->NumberOfElements(), 1);
CHECK_EQ(1, table->NumberOfElements());
CHECK(table->Has(isolate, a));
CHECK(!table->Has(isolate, b));
@ -142,7 +142,7 @@ static void TestHashSet(Handle<HashSet> table) {
// bool was_present = false;
// table = HashSet::Remove(table, a, &was_present);
// CHECK(was_present);
// CHECK_EQ(table->NumberOfElements(), 0);
// CHECK_EQ(0, table->NumberOfElements());
// CHECK(!table->Has(a));
// CHECK(!table->Has(b));

View File

@ -78,7 +78,7 @@ TEST(JSObjectAddingProperties) {
Handle<JSObject> object = factory->NewJSObject(function);
Handle<Map> previous_map(object->map());
CHECK_EQ(previous_map->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, previous_map->elements_kind());
CHECK(EQUALS(object->properties(), empty_fixed_array));
CHECK(EQUALS(object->elements(), empty_fixed_array));
@ -88,7 +88,7 @@ TEST(JSObjectAddingProperties) {
JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE)
.Check();
CHECK_NE(object->map(), *previous_map);
CHECK_EQ(object->map()->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
CHECK_LE(1, object->properties()->length());
CHECK(EQUALS(object->elements(), empty_fixed_array));
}
@ -109,7 +109,7 @@ TEST(JSObjectInObjectAddingProperties) {
Handle<JSObject> object = factory->NewJSObject(function);
Handle<Map> previous_map(object->map());
CHECK_EQ(previous_map->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, previous_map->elements_kind());
CHECK(EQUALS(object->properties(), empty_fixed_array));
CHECK(EQUALS(object->elements(), empty_fixed_array));
@ -121,7 +121,7 @@ TEST(JSObjectInObjectAddingProperties) {
.Check();
}
CHECK_NE(object->map(), *previous_map);
CHECK_EQ(object->map()->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
CHECK(EQUALS(object->properties(), empty_fixed_array));
CHECK(EQUALS(object->elements(), empty_fixed_array));
@ -132,7 +132,7 @@ TEST(JSObjectInObjectAddingProperties) {
JSObject::DefinePropertyOrElementIgnoreAttributes(object, name, value, NONE)
.Check();
CHECK_NE(object->map(), *previous_map);
CHECK_EQ(object->map()->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
// there must be at least 1 element in the properies store
CHECK_LE(1, object->properties()->length());
CHECK(EQUALS(object->elements(), empty_fixed_array));
@ -152,7 +152,7 @@ TEST(JSObjectAddingElements) {
Handle<JSObject> object = factory->NewJSObject(function);
Handle<Map> previous_map(object->map());
CHECK_EQ(previous_map->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, previous_map->elements_kind());
CHECK(EQUALS(object->properties(), empty_fixed_array));
CHECK(EQUALS(object->elements(), empty_fixed_array));
@ -162,7 +162,7 @@ TEST(JSObjectAddingElements) {
.Check();
// no change in elements_kind => no map transition
CHECK_EQ(object->map(), *previous_map);
CHECK_EQ(object->map()->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
CHECK(EQUALS(object->properties(), empty_fixed_array));
CHECK_LE(1, object->elements()->length());
@ -175,7 +175,7 @@ TEST(JSObjectAddingElements) {
}
// no change in elements_kind => no map transition
CHECK_EQ(object->map(), *previous_map);
CHECK_EQ(object->map()->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, object->map()->elements_kind());
CHECK(EQUALS(object->properties(), empty_fixed_array));
CHECK_LE(non_dict_backing_store_limit, object->elements()->length());
@ -186,7 +186,7 @@ TEST(JSObjectAddingElements) {
.Check();
// change in elements_kind => map transition
CHECK_NE(object->map(), *previous_map);
CHECK_EQ(object->map()->elements_kind(), DICTIONARY_ELEMENTS);
CHECK_EQ(DICTIONARY_ELEMENTS, object->map()->elements_kind());
CHECK(EQUALS(object->properties(), empty_fixed_array));
CHECK_LE(non_dict_backing_store_limit, object->elements()->length());
}
@ -204,10 +204,10 @@ TEST(JSArrayAddingProperties) {
Handle<JSArray> array =
factory->NewJSArray(ElementsKind::FAST_SMI_ELEMENTS, 0, 0);
Handle<Map> previous_map(array->map());
CHECK_EQ(previous_map->elements_kind(), FAST_SMI_ELEMENTS);
CHECK_EQ(FAST_SMI_ELEMENTS, previous_map->elements_kind());
CHECK(EQUALS(array->properties(), empty_fixed_array));
CHECK(EQUALS(array->elements(), empty_fixed_array));
CHECK_EQ(Smi::cast(array->length())->value(), 0);
CHECK_EQ(0, Smi::cast(array->length())->value());
// for the default constructor function no in-object properties are reserved
// hence adding a single property will initialize the property-array
@ -216,10 +216,10 @@ TEST(JSArrayAddingProperties) {
.Check();
// No change in elements_kind but added property => new map
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_SMI_ELEMENTS);
CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind());
CHECK_LE(1, array->properties()->length());
CHECK(EQUALS(array->elements(), empty_fixed_array));
CHECK_EQ(Smi::cast(array->length())->value(), 0);
CHECK_EQ(0, Smi::cast(array->length())->value());
}
@ -236,10 +236,10 @@ TEST(JSArrayAddingElements) {
Handle<JSArray> array =
factory->NewJSArray(ElementsKind::FAST_SMI_ELEMENTS, 0, 0);
Handle<Map> previous_map(array->map());
CHECK_EQ(previous_map->elements_kind(), FAST_SMI_ELEMENTS);
CHECK_EQ(FAST_SMI_ELEMENTS, previous_map->elements_kind());
CHECK(EQUALS(array->properties(), empty_fixed_array));
CHECK(EQUALS(array->elements(), empty_fixed_array));
CHECK_EQ(Smi::cast(array->length())->value(), 0);
CHECK_EQ(0, Smi::cast(array->length())->value());
// Adding an indexed element initializes the elements array
name = MakeString("0");
@ -247,7 +247,7 @@ TEST(JSArrayAddingElements) {
.Check();
// no change in elements_kind => no map transition
CHECK_EQ(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_SMI_ELEMENTS);
CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind());
CHECK(EQUALS(array->properties(), empty_fixed_array));
CHECK_LE(1, array->elements()->length());
CHECK_EQ(1, Smi::cast(array->length())->value());
@ -261,7 +261,7 @@ TEST(JSArrayAddingElements) {
}
// no change in elements_kind => no map transition
CHECK_EQ(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_SMI_ELEMENTS);
CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind());
CHECK(EQUALS(array->properties(), empty_fixed_array));
CHECK_LE(non_dict_backing_store_limit, array->elements()->length());
CHECK_EQ(non_dict_backing_store_limit, Smi::cast(array->length())->value());
@ -274,7 +274,7 @@ TEST(JSArrayAddingElements) {
.Check();
// change in elements_kind => map transition
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), DICTIONARY_ELEMENTS);
CHECK_EQ(DICTIONARY_ELEMENTS, array->map()->elements_kind());
CHECK(EQUALS(array->properties(), empty_fixed_array));
CHECK_LE(non_dict_backing_store_limit, array->elements()->length());
CHECK_LE(array->elements()->length(), index);
@ -296,8 +296,8 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
Handle<JSArray> array =
factory->NewJSArray(ElementsKind::FAST_SMI_ELEMENTS, 0, 0);
Handle<Map> previous_map(array->map());
CHECK_EQ(previous_map->elements_kind(), FAST_SMI_ELEMENTS);
CHECK_EQ(Smi::cast(array->length())->value(), 0);
CHECK_EQ(FAST_SMI_ELEMENTS, previous_map->elements_kind());
CHECK_EQ(0, Smi::cast(array->length())->value());
// `array[0] = smi_value` doesn't change the elements_kind
name = MakeString("0");
@ -306,14 +306,14 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
.Check();
// no change in elements_kind => no map transition
CHECK_EQ(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_SMI_ELEMENTS);
CHECK_EQ(FAST_SMI_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(1, Smi::cast(array->length())->value());
// `delete array[0]` does not alter length, but changes the elments_kind
name = MakeString("0");
CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_SMI_ELEMENTS);
CHECK_EQ(FAST_HOLEY_SMI_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(1, Smi::cast(array->length())->value());
previous_map = handle(array->map());
@ -327,7 +327,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
NONE)
.Check();
CHECK_EQ(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_SMI_ELEMENTS);
CHECK_EQ(FAST_HOLEY_SMI_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(2, Smi::cast(array->length())->value());
// Adding a string to the array changes from FAST_HOLEY_SMI to FAST_HOLEY
@ -336,7 +336,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
NONE)
.Check();
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(2, Smi::cast(array->length())->value());
previous_map = handle(array->map());
@ -369,8 +369,8 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
Handle<JSArray> array =
factory->NewJSArray(ElementsKind::FAST_ELEMENTS, 0, 0);
Handle<Map> previous_map(array->map());
CHECK_EQ(previous_map->elements_kind(), FAST_ELEMENTS);
CHECK_EQ(Smi::cast(array->length())->value(), 0);
CHECK_EQ(FAST_ELEMENTS, previous_map->elements_kind());
CHECK_EQ(0, Smi::cast(array->length())->value());
// `array[0] = smi_value` doesn't change the elements_kind
name = MakeString("0");
@ -379,14 +379,14 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
.Check();
// no change in elements_kind => no map transition
CHECK_EQ(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_ELEMENTS);
CHECK_EQ(FAST_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(1, Smi::cast(array->length())->value());
// `delete array[0]` does not alter length, but changes the elments_kind
name = MakeString("0");
CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(1, Smi::cast(array->length())->value());
previous_map = handle(array->map());
@ -400,7 +400,7 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
NONE)
.Check();
CHECK_EQ(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(2, Smi::cast(array->length())->value());
}
@ -426,7 +426,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
NONE)
.Check();
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_DOUBLE_ELEMENTS);
CHECK_EQ(FAST_DOUBLE_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(1, Smi::cast(array->length())->value());
previous_map = handle(array->map());
@ -436,14 +436,14 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
NONE)
.Check();
CHECK_EQ(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_DOUBLE_ELEMENTS);
CHECK_EQ(FAST_DOUBLE_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(2, Smi::cast(array->length())->value());
// `delete array[0]` does not alter length, but changes the elments_kind
name = MakeString("0");
CHECK(JSReceiver::DeletePropertyOrElement(array, name).FromMaybe(false));
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_DOUBLE_ELEMENTS);
CHECK_EQ(FAST_HOLEY_DOUBLE_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(2, Smi::cast(array->length())->value());
previous_map = handle(array->map());
@ -453,7 +453,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
NONE)
.Check();
CHECK_EQ(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_DOUBLE_ELEMENTS);
CHECK_EQ(FAST_HOLEY_DOUBLE_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(2, Smi::cast(array->length())->value());
// Adding a string to the array changes to elements_kind FAST_ELEMENTS
@ -462,7 +462,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
NONE)
.Check();
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(array->map()->elements_kind(), FAST_HOLEY_ELEMENTS);
CHECK_EQ(FAST_HOLEY_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(2, Smi::cast(array->length())->value());
previous_map = handle(array->map());

View File

@ -257,5 +257,5 @@ TEST(FlagsRemoveIncomplete) {
const_cast<char **>(argv),
true));
CHECK(argv[1]);
CHECK_EQ(argc, 2);
CHECK_EQ(2, argc);
}

View File

@ -193,7 +193,7 @@ TEST(LoadAddress) {
__ bind(&skip);
__ li(a4, Operand(masm->jump_address(&to_jump)), ADDRESS_LOAD);
int check_size = masm->InstructionsGeneratedSince(&skip);
CHECK_EQ(check_size, 4);
CHECK_EQ(4, check_size);
__ jr(a4);
__ nop();
__ stop("invalid");

View File

@ -1166,7 +1166,7 @@ TEST(ScopePositions) {
// Check scope types and positions.
i::Scope* scope = info.literal()->scope();
CHECK(scope->is_script_scope());
CHECK_EQ(scope->start_position(), 0);
CHECK_EQ(0, scope->start_position());
CHECK_EQ(scope->end_position(), kProgramSize);
i::Scope* inner_scope = scope->inner_scope();
@ -6791,15 +6791,15 @@ TEST(ModuleParsingInternals) {
CHECK_EQ(5u, descriptor->module_requests().size());
for (const auto& elem : descriptor->module_requests()) {
if (elem.first->IsOneByteEqualTo("m.js"))
CHECK_EQ(elem.second, 0);
CHECK_EQ(0, elem.second);
else if (elem.first->IsOneByteEqualTo("n.js"))
CHECK_EQ(elem.second, 1);
CHECK_EQ(1, elem.second);
else if (elem.first->IsOneByteEqualTo("p.js"))
CHECK_EQ(elem.second, 2);
CHECK_EQ(2, elem.second);
else if (elem.first->IsOneByteEqualTo("q.js"))
CHECK_EQ(elem.second, 3);
CHECK_EQ(3, elem.second);
else if (elem.first->IsOneByteEqualTo("bar.js"))
CHECK_EQ(elem.second, 4);
CHECK_EQ(4, elem.second);
else
CHECK(false);
}

View File

@ -137,18 +137,18 @@ TEST(LayoutDescriptorBasicFast) {
CHECK_EQ(kSmiValueSize, layout_desc->capacity());
for (int i = 0; i < kSmiValueSize + 13; i++) {
CHECK_EQ(true, layout_desc->IsTagged(i));
CHECK(layout_desc->IsTagged(i));
}
CHECK_EQ(true, layout_desc->IsTagged(-1));
CHECK_EQ(true, layout_desc->IsTagged(-12347));
CHECK_EQ(true, layout_desc->IsTagged(15635));
CHECK(layout_desc->IsTagged(-1));
CHECK(layout_desc->IsTagged(-12347));
CHECK(layout_desc->IsTagged(15635));
CHECK(layout_desc->IsFastPointerLayout());
for (int i = 0; i < kSmiValueSize; i++) {
layout_desc = layout_desc->SetTaggedForTesting(i, false);
CHECK_EQ(false, layout_desc->IsTagged(i));
CHECK(!layout_desc->IsTagged(i));
layout_desc = layout_desc->SetTaggedForTesting(i, true);
CHECK_EQ(true, layout_desc->IsTagged(i));
CHECK(layout_desc->IsTagged(i));
}
CHECK(layout_desc->IsFastPointerLayout());
@ -157,7 +157,7 @@ TEST(LayoutDescriptorBasicFast) {
&sequence_length));
CHECK_EQ(std::numeric_limits<int>::max(), sequence_length);
CHECK_EQ(true, layout_desc->IsTagged(0, 7, &sequence_length));
CHECK(layout_desc->IsTagged(0, 7, &sequence_length));
CHECK_EQ(7, sequence_length);
}
@ -203,9 +203,9 @@ TEST(LayoutDescriptorBasicSlow) {
CHECK(!layout_descriptor->IsSlowLayout());
CHECK(!layout_descriptor->IsFastPointerLayout());
CHECK_EQ(false, layout_descriptor->IsTagged(0));
CHECK(!layout_descriptor->IsTagged(0));
for (int i = 1; i < kPropsCount; i++) {
CHECK_EQ(true, layout_descriptor->IsTagged(i));
CHECK(layout_descriptor->IsTagged(i));
}
InitializeVerifiedMapDescriptors(*map, *descriptors, *layout_descriptor);
}
@ -220,26 +220,26 @@ TEST(LayoutDescriptorBasicSlow) {
CHECK(!layout_descriptor->IsFastPointerLayout());
CHECK(layout_descriptor->capacity() > kSmiValueSize);
CHECK_EQ(false, layout_descriptor->IsTagged(0));
CHECK_EQ(false, layout_descriptor->IsTagged(kPropsCount - 1));
CHECK(!layout_descriptor->IsTagged(0));
CHECK(!layout_descriptor->IsTagged(kPropsCount - 1));
for (int i = 1; i < kPropsCount - 1; i++) {
CHECK_EQ(true, layout_descriptor->IsTagged(i));
CHECK(layout_descriptor->IsTagged(i));
}
InitializeVerifiedMapDescriptors(*map, *descriptors, *layout_descriptor);
// Here we have truly slow layout descriptor, so play with the bits.
CHECK_EQ(true, layout_descriptor->IsTagged(-1));
CHECK_EQ(true, layout_descriptor->IsTagged(-12347));
CHECK_EQ(true, layout_descriptor->IsTagged(15635));
CHECK(layout_descriptor->IsTagged(-1));
CHECK(layout_descriptor->IsTagged(-12347));
CHECK(layout_descriptor->IsTagged(15635));
LayoutDescriptor* layout_desc = *layout_descriptor;
// Play with the bits but leave it in consistent state with map at the end.
for (int i = 1; i < kPropsCount - 1; i++) {
layout_desc = layout_desc->SetTaggedForTesting(i, false);
CHECK_EQ(false, layout_desc->IsTagged(i));
CHECK(!layout_desc->IsTagged(i));
layout_desc = layout_desc->SetTaggedForTesting(i, true);
CHECK_EQ(true, layout_desc->IsTagged(i));
CHECK(layout_desc->IsTagged(i));
}
CHECK(layout_desc->IsSlowLayout());
CHECK(!layout_desc->IsFastPointerLayout());
@ -520,10 +520,10 @@ TEST(LayoutDescriptorCreateNewFast) {
layout_descriptor = LayoutDescriptor::New(map, descriptors, kPropsCount);
CHECK_NE(LayoutDescriptor::FastPointerLayout(), *layout_descriptor);
CHECK(!layout_descriptor->IsSlowLayout());
CHECK_EQ(true, layout_descriptor->IsTagged(0));
CHECK_EQ(false, layout_descriptor->IsTagged(1));
CHECK_EQ(true, layout_descriptor->IsTagged(2));
CHECK_EQ(true, layout_descriptor->IsTagged(125));
CHECK(layout_descriptor->IsTagged(0));
CHECK(!layout_descriptor->IsTagged(1));
CHECK(layout_descriptor->IsTagged(2));
CHECK(layout_descriptor->IsTagged(125));
InitializeVerifiedMapDescriptors(*map, *descriptors, *layout_descriptor);
}
}
@ -563,10 +563,10 @@ TEST(LayoutDescriptorCreateNewSlow) {
layout_descriptor = LayoutDescriptor::New(map, descriptors, kPropsCount);
CHECK_NE(LayoutDescriptor::FastPointerLayout(), *layout_descriptor);
CHECK(!layout_descriptor->IsSlowLayout());
CHECK_EQ(true, layout_descriptor->IsTagged(0));
CHECK_EQ(false, layout_descriptor->IsTagged(1));
CHECK_EQ(true, layout_descriptor->IsTagged(2));
CHECK_EQ(true, layout_descriptor->IsTagged(125));
CHECK(layout_descriptor->IsTagged(0));
CHECK(!layout_descriptor->IsTagged(1));
CHECK(layout_descriptor->IsTagged(2));
CHECK(layout_descriptor->IsTagged(125));
InitializeVerifiedMapDescriptors(*map, *descriptors, *layout_descriptor);
}
@ -583,7 +583,7 @@ TEST(LayoutDescriptorCreateNewSlow) {
}
// Every property after inobject_properties must be tagged.
for (int i = inobject_properties; i < kPropsCount; i++) {
CHECK_EQ(true, layout_descriptor->IsTagged(i));
CHECK(layout_descriptor->IsTagged(i));
}
InitializeVerifiedMapDescriptors(*map, *descriptors, *layout_descriptor);
@ -1224,19 +1224,19 @@ static void TestLayoutDescriptorHelper(Isolate* isolate,
if (end_of_region_offset < instance_size) {
CHECK_EQ(!expected_tagged, helper.IsTagged(end_of_region_offset));
} else {
CHECK_EQ(true, helper.IsTagged(end_of_region_offset));
CHECK(helper.IsTagged(end_of_region_offset));
}
}
for (int offset = 0; offset < JSObject::kHeaderSize; offset += kPointerSize) {
// Header queries
CHECK_EQ(true, helper.IsTagged(offset));
CHECK(helper.IsTagged(offset));
int end_of_region_offset;
CHECK_EQ(true, helper.IsTagged(offset, end_offset, &end_of_region_offset));
CHECK(helper.IsTagged(offset, end_offset, &end_of_region_offset));
CHECK_EQ(first_non_tagged_field_offset, end_of_region_offset);
// Out of bounds queries
CHECK_EQ(true, helper.IsTagged(offset + instance_size));
CHECK(helper.IsTagged(offset + instance_size));
}
CHECK_EQ(all_fields_tagged, helper.all_fields_tagged());

View File

@ -88,11 +88,11 @@ TEST(BitSetComputer) {
uint32_t data = 0;
data = BoolComputer::encode(data, 1, true);
data = BoolComputer::encode(data, 4, true);
CHECK_EQ(true, BoolComputer::decode(data, 1));
CHECK_EQ(true, BoolComputer::decode(data, 4));
CHECK_EQ(false, BoolComputer::decode(data, 0));
CHECK_EQ(false, BoolComputer::decode(data, 2));
CHECK_EQ(false, BoolComputer::decode(data, 3));
CHECK(BoolComputer::decode(data, 1));
CHECK(BoolComputer::decode(data, 4));
CHECK(!BoolComputer::decode(data, 0));
CHECK(!BoolComputer::decode(data, 2));
CHECK(!BoolComputer::decode(data, 3));
// Lets store 2 bits per item with 3000 items and verify the values are
// correct.