Update of /cvsroot/mockpp/mockpp/mockpp/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11364/mockpp/tests
Modified Files:
ResponseVector_test.cpp
Log Message:
more tests
Index: ResponseVector_test.cpp
===================================================================
RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ResponseVector_test.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ResponseVector_test.cpp 31 Oct 2005 19:08:10 -0000 1.3
+++ ResponseVector_test.cpp 2 Nov 2005 20:57:30 -0000 1.4
@@ -47,12 +47,14 @@
CPPUNIT_TEST_SUITE( ResponseVector_Test );
+ CPPUNIT_TEST(test_value);
CPPUNIT_TEST(test_thrower);
CPPUNIT_TEST_SUITE_END();
public:
+ void test_value();
void test_thrower();
};
@@ -60,9 +62,85 @@
CPPUNIT_TEST_SUITE_REGISTRATION(ResponseVector_Test);
+void ResponseVector_Test::test_value()
+{
+ mockpp::ResponseVector3<long, int, int, int> rtv(MOCKPP_PCHAR("rtv3"), 0);
+ rtv.add(mockpp::make_throwable(int(123)), 10, 20, 30, 2);
+ rtv.add(mockpp::make_throwable(int(321)), 30, 20, 10, MOCKPP_UNLIMITED);
+
+ rtv.add(long(456), 11, 21, 31, 2);
+ rtv.add(long(654), 31, 21, 11, MOCKPP_UNLIMITED);
+
+ mockpp::Throwable *t;
+
+ MOCKPP_ASSERT_TRUE(rtv.find(t, 30, 20, 10));
+ MOCKPP_ASSERT_THROWING(t->throw_me(),
+ MOCKPP_PCHAR("321"),
+ int,
+ int(321));
+
+ long r;
+ MOCKPP_ASSERT_FALSE(rtv.find(r, 32, 22, 12));
+ MOCKPP_ASSERT_TRUE(rtv.find(r, 31, 21, 11));
+ MOCKPP_ASSERT_TRUE(r == 654);
+
+ MOCKPP_ASSERT_TRUE(rtv.find(r, 11, 21, 31));
+ MOCKPP_ASSERT_TRUE(r == 456);
+
+ MOCKPP_ASSERT_TRUE(rtv.find(r, 31, 21, 11));
+ MOCKPP_ASSERT_TRUE(r == 654);
+
+ MOCKPP_ASSERT_TRUE(rtv.find(r, 11, 21, 31));
+ MOCKPP_ASSERT_TRUE(r == 456);
+
+ MOCKPP_ASSERT_TRUE(rtv.find(r, 31, 21, 11));
+ MOCKPP_ASSERT_TRUE(r == 654);
+
+ MOCKPP_ASSERT_FALSE(rtv.find(r, 11, 21, 31));
+
+ MOCKPP_ASSERT_FALSE(rtv.find(t, 10, 10, 10));
+
+ MOCKPP_ASSERT_TRUE(rtv.find(t, 10, 20, 30));
+ MOCKPP_ASSERT_TRUE(rtv.find(t, 10, 20, 30));
+ MOCKPP_ASSERT_FALSE(rtv.find(t, 10, 20, 30));
+
+ MOCKPP_ASSERT_TRUE(rtv.find(t, 30, 20, 10));
+ MOCKPP_ASSERT_TRUE(rtv.find(t, 30, 20, 10));
+ MOCKPP_ASSERT_TRUE(rtv.find(t, 30, 20, 10));
+}
+
+
void ResponseVector_Test::test_thrower()
{
mockpp::ResponseThrowableVector3<int, int, int> rtv(MOCKPP_PCHAR("rtv3"), 0);
+
+ rtv.add(mockpp::make_throwable(int(123)), 10, 20, 30, 1);
+ rtv.add(mockpp::make_throwable(int(321)), 30, 20, 10, MOCKPP_UNLIMITED);
+ rtv.add(0, 10, 10, 10, MOCKPP_UNLIMITED);
+
+ mockpp::Throwable *t;
+
+ MOCKPP_ASSERT_TRUE(rtv.find(t, 30, 20, 10));
+ MOCKPP_ASSERT_THROWING(t->throw_me(),
+ MOCKPP_PCHAR("321"),
+ int,
+ int(321));
+
+ MOCKPP_ASSERT_TRUE(rtv.find(t, 10, 20, 30));
+ MOCKPP_ASSERT_THROWING(t->throw_me(),
+ MOCKPP_PCHAR("123"),
+ int,
+ int(123));
+
+ MOCKPP_ASSERT_FALSE(rtv.find(t, 10, 10, 10));
+
+ MOCKPP_ASSERT_FALSE(rtv.find(t, 10, 20, 30));
+
+ MOCKPP_ASSERT_TRUE(rtv.find(t, 30, 20, 10));
+ MOCKPP_ASSERT_THROWING(t->throw_me(),
+ MOCKPP_PCHAR("321"),
+ int,
+ int(321));
}
|