diff --git a/btree.h b/btree.h index b9fd04e2..afb508da 100644 --- a/btree.h +++ b/btree.h @@ -1435,6 +1435,11 @@ class btree : public Params::key_compare { sizeof(key_compare_checker(key_compare_helper()(key_type(), key_type()))) == sizeof(base::big_), key_comparison_function_must_return_bool); + + // Note: We insist on kTargetValues, which is computed from + // Params::kTargetNodeSize, falling under 256 because of the uint8 + // fields of base_fields. + COMPILE_ASSERT(kNodeValues < 256, target_node_size_too_large); }; //// diff --git a/btree_nc.cc b/btree_nc.cc index b24c312d..7f1260be 100644 --- a/btree_nc.cc +++ b/btree_nc.cc @@ -40,7 +40,11 @@ TEST_COMPARE_TO(int); #elif defined(TEST_compare_to_float) TEST_COMPARE_TO(float); #elif defined(TEST_compare_to_pointer) -TEST_COMPARE_TO(pointer); +TEST_COMPARE_TO(void*); +#elif defined(TEST_large_nodesize) +void LargeNode() { + util::btree::btree_set, std::allocator, 10000> set; +} #endif } // namespace diff --git a/btree_nc_test.py b/btree_nc_test.py index 056a75d2..b2a83277 100755 --- a/btree_nc_test.py +++ b/btree_nc_test.py @@ -30,28 +30,20 @@ class BtreeNegativeUnitTest(googletest.TestCase): # Test that int does not work as a return type for key comparison. ('int', - [r'error: creating array with negative size', # for gcc - r'', # for icc - ]), + [r'key_comparison_function_must_return_bool']), # Test that float does not work as a return type for key comparison. ('float', - [r'error: creating array with negative size', # for gcc - r'', # for icc - ]), + [r'key_comparison_function_must_return_bool']), # Test that void* does not work as a return type for key comparison. ('pointer', - [r'error: creating array with negative size', # for gcc - r'', # for icc - ]), + [r'key_comparison_function_must_return_bool']), # Test that bool does not work as a return type for compare-to # comparison. ('compare_to_bool', - [r'error: creating array with negative size', # for gcc - r'', # for icc - ]), + [r'key_comparison_function_must_return_bool']), # Test that int works as a return type for compare-to comparison. ('compare_to_int', None), # None means compilation should succeed. @@ -59,16 +51,16 @@ class BtreeNegativeUnitTest(googletest.TestCase): # Test that float does not work as a return type for compare-to # comparison. ('compare_to_float', - [r'error: creating array with negative size', # for gcc - r'', # for icc - ]), + [r'key_comparison_function_must_return_bool']), # Test that void* does not work as a return type for compare-to # comparison. ('compare_to_pointer', - [r'error: creating array with negative size', # for gcc - r'', # for icc - ]), + [r'key_comparison_function_must_return_bool']), + + # Test that large node sizes do not compile. + ('large_nodesize', + [r'target_node_size_too_large']), ] # Runs the list of tests.