List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:January 14 2011 2:38pm
Subject:bzr commit into mysql-trunk branch (tor.didriksen:3366)
View as plain text  
#At file:///export/home/didrik/repo/next-mr-gtest-bitmap/ based on revid:tor.didriksen@stripped

 3366 Tor Didriksen	2011-01-14
      unit test for bitmap: use << rather than printf for error reporting

    modified:
      unittest/gunit/my_bitmap-t.cc
=== modified file 'unittest/gunit/my_bitmap-t.cc'
--- a/unittest/gunit/my_bitmap-t.cc	2011-01-14 12:38:40 +0000
+++ b/unittest/gunit/my_bitmap-t.cc	2011-01-14 14:38:04 +0000
@@ -43,10 +43,10 @@ bool test_set_get_clear_bit(MY_BITMAP *m
   }
   return FALSE;
 error1:
-  printf("Error in set bit, bit %u, bitsize = %u", test_bit, bitsize);
+  ADD_FAILURE() << "Error in set bit, bit " << test_bit;
   return TRUE;
 error2:
-  printf("Error in clear bit, bit %u, bitsize = %u", test_bit, bitsize);
+  ADD_FAILURE() << "Error in clear bit, bit " << test_bit;
   return TRUE;
 }
 
@@ -66,10 +66,10 @@ bool test_flip_bit(MY_BITMAP *map, uint 
   }
   return FALSE;
 error1:
-  printf("Error in flip bit 1, bit %u, bitsize = %u", test_bit, bitsize);
+  ADD_FAILURE() << "Error in flip bit 1, bit " << test_bit;
   return TRUE;
 error2:
-  printf("Error in flip bit 2, bit %u, bitsize = %u", test_bit, bitsize);
+  ADD_FAILURE() << "Error in flip bit 2, bit " << test_bit;
   return TRUE;
 }
 
@@ -102,22 +102,22 @@ bool test_get_all_bits(MY_BITMAP *map, u
     goto error4;
   return FALSE;
 error1:
-  printf("Error in set_all, bitsize = %u", bitsize);
+  ADD_FAILURE() << "Error in set_all";
   return TRUE;
 error2:
-  printf("Error in clear_all, bitsize = %u", bitsize);
+  ADD_FAILURE() << "Error in clear_all";
   return TRUE;
 error3:
-  printf("Error in bitmap_is_set_all, bitsize = %u", bitsize);
+  ADD_FAILURE() << "Error in bitmap_is_set_all";
   return TRUE;
 error4:
-  printf("Error in bitmap_is_clear_all, bitsize = %u", bitsize);
+  ADD_FAILURE() << "Error in bitmap_is_clear_all";
   return TRUE;
 error5:
-  printf("Error in set_all through set_prefix, bitsize = %u", bitsize);
+  ADD_FAILURE() << "Error in set_all through set_prefix";
   return TRUE;
 error6:
-  printf("Error in clear_all through set_prefix, bitsize = %u", bitsize);
+  ADD_FAILURE() << "Error in clear_all through set_prefix";
   return TRUE;
 }
 
@@ -206,24 +206,24 @@ bool test_compare_operators(MY_BITMAP *m
   }
   return FALSE;
 error1:
-  printf("intersect error  bitsize=%u,size1=%u,size2=%u", bitsize,
-  test_bit1,test_bit2);
+  ADD_FAILURE() << "intersect error "
+                << "size1=" << test_bit1 << ",size2=" << test_bit2;
   return TRUE;
 error2:
-  printf("union error  bitsize=%u,size1=%u,size2=%u", bitsize,
-  test_bit1,test_bit2);
+  ADD_FAILURE() << "union error "
+                << "size1=" << test_bit1 << ",size2=" << test_bit2;
   return TRUE;
 error3:
-  printf("xor error  bitsize=%u,size1=%u,size2=%u", bitsize,
-  test_bit1,test_bit2);
+  ADD_FAILURE() << "xor error " 
+                << "size1=" << test_bit1 << ",size2=" << test_bit2;
   return TRUE;
 error4:
-  printf("subtract error  bitsize=%u,size1=%u,size2=%u", bitsize,
-  test_bit1,test_bit2);
+  ADD_FAILURE() << "subtract error "
+                << "size1=" << test_bit1 << ",size2=" << test_bit2;
   return TRUE;
 error5:
-  printf("invert error  bitsize=%u,size=%u", bitsize,
-  test_bit1);
+  ADD_FAILURE() << "invert error "
+                << "size1=" << test_bit1 << ",size2=" << test_bit2;
   return TRUE;
 }
 
@@ -246,10 +246,10 @@ bool test_count_bits_set(MY_BITMAP *map,
     goto error2;
   return FALSE;
 error1:
-  printf("No bits set  bitsize = %u", bitsize);
+  ADD_FAILURE() << "No bits set";
   return TRUE;
 error2:
-  printf("Wrong count of bits set, bitsize = %u", bitsize);
+  ADD_FAILURE() << "Wrong count of bits set";
   return TRUE;
 }
 
@@ -271,10 +271,10 @@ bool test_get_first_bit(MY_BITMAP *map, 
   }
   return FALSE;
 error1:
-  printf("get_first_set error bitsize=%u,prefix_size=%u",bitsize,test_bit);
+  ADD_FAILURE() << "get_first_set error ,prefix_size=%u" << test_bit;
   return TRUE;
 error2:
-  printf("get_first error bitsize= %u, prefix_size= %u",bitsize,test_bit);
+  ADD_FAILURE() << "get_first error prefix_size=" << test_bit;
   return TRUE;
 }
 
@@ -293,7 +293,7 @@ bool test_get_next_bit(MY_BITMAP *map, u
   }
   return FALSE;
 error1:
-  printf("get_next error  bitsize= %u, prefix_size= %u", bitsize,test_bit);
+  ADD_FAILURE() << "get_next error prefix_size=" << test_bit;
   return TRUE;
 }
 
@@ -321,13 +321,13 @@ bool test_prefix(MY_BITMAP *map, uint bi
   }
   return FALSE;
 error1:
-  printf("prefix1 error  bitsize = %u, prefix_size = %u", bitsize,test_bit);
+  ADD_FAILURE() << "prefix1 error, prefix_size = " << test_bit;
   return TRUE;
 error2:
-  printf("prefix2 error  bitsize = %u, prefix_size = %u", bitsize,test_bit);
+  ADD_FAILURE() << "prefix2 error, prefix_size = " << test_bit;
   return TRUE;
 error3:
-  printf("prefix3 error  bitsize = %u, prefix_size = %u", bitsize,test_bit);
+  ADD_FAILURE() << "prefix3 error, prefix_size = " << test_bit;
   return TRUE;
 }
 
@@ -352,47 +352,47 @@ INSTANTIATE_TEST_CASE_P(Foo, BitMapTest,
 
 TEST_P(BitMapTest, TestSetGetClearBit)
 {
-  EXPECT_FALSE(test_set_get_clear_bit(&map, bitsize));
+  EXPECT_FALSE(test_set_get_clear_bit(&map, bitsize)) << "bitsize=" << bitsize;
 }
 
 TEST_P(BitMapTest, TestFlipBit)
 {
-  EXPECT_FALSE(test_flip_bit(&map, bitsize));
+  EXPECT_FALSE(test_flip_bit(&map, bitsize)) << "bitsize=" << bitsize;
 }
 
 TEST_P(BitMapTest, TestOperators)
 {
-  EXPECT_FALSE(test_operators(&map, bitsize));
+  EXPECT_FALSE(test_operators(&map, bitsize)) << "bitsize=" << bitsize;
 }
 
 TEST_P(BitMapTest, TestGetAllBits)
 {
-  EXPECT_FALSE(test_get_all_bits(&map, bitsize));
+  EXPECT_FALSE(test_get_all_bits(&map, bitsize)) << "bitsize=" << bitsize;
 }
 
 TEST_P(BitMapTest, TestCompareOperators)
 {
-  EXPECT_FALSE(test_compare_operators(&map, bitsize));
+  EXPECT_FALSE(test_compare_operators(&map, bitsize)) << "bitsize=" << bitsize;
 }
 
 TEST_P(BitMapTest, TestCountBitsSet)
 {
-  EXPECT_FALSE(test_count_bits_set(&map, bitsize));
+  EXPECT_FALSE(test_count_bits_set(&map, bitsize)) << "bitsize=" << bitsize;
 }
 
 TEST_P(BitMapTest, TestGetFirstBit)
 {
-  EXPECT_FALSE(test_get_first_bit(&map, bitsize));
+  EXPECT_FALSE(test_get_first_bit(&map, bitsize)) << "bitsize=" << bitsize;
 }
 
 TEST_P(BitMapTest, TestGetNextBit)
 {
-  EXPECT_FALSE(test_get_next_bit(&map, bitsize));
+  EXPECT_FALSE(test_get_next_bit(&map, bitsize)) << "bitsize=" << bitsize;
 }
 
 TEST_P(BitMapTest, TestPrefix)
 {
-  EXPECT_FALSE(test_prefix(&map, bitsize));
+  EXPECT_FALSE(test_prefix(&map, bitsize)) << "bitsize=" << bitsize;
 }
 
 #endif


Attachment: [text/bzr-bundle] bzr/tor.didriksen@oracle.com-20110114143804-tcf6cnevzg5zgbty.bundle
Thread
bzr commit into mysql-trunk branch (tor.didriksen:3366) Tor Didriksen14 Jan