[test] TestReshape: check small then large
authorEvan Shelhamer <shelhamer@imaginarynumber.net>
Wed, 23 Sep 2015 20:38:29 +0000 (13:38 -0700)
committerEvan Shelhamer <shelhamer@imaginarynumber.net>
Thu, 24 Sep 2015 03:24:10 +0000 (20:24 -0700)
checking large then small can mask failure since the smaller shape
memory will fit within the larger shape.

src/caffe/test/test_net.cpp

index 12998d8..ec01053 100644 (file)
@@ -2269,8 +2269,10 @@ TYPED_TEST(NetTest, TestReshape) {
   FillerParameter filler_param;
   filler_param.set_std(1);
   GaussianFiller<Dtype> filler(filler_param);
-  Blob<Dtype> blob1(4, 3, 9, 11);
-  Blob<Dtype> blob2(2, 3, 12, 10);
+  // Check smaller shape first as larger first could hide realloc failures.
+  Blob<Dtype> blob1(2, 3, 12, 10);
+  Blob<Dtype> blob2(4, 3, 9, 11);
+  ASSERT_LT(blob1.count(), blob2.count());
   filler.Fill(&blob1);
   filler.Fill(&blob2);