IGNITE-2495: Updated cursor tests to match cursor desired behaviour.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0b26795d Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0b26795d Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0b26795d Branch: refs/heads/ignite-1786 Commit: 0b26795deed9ba0932e4f8ed85d0465540660137 Parents: ac0b59f Author: isapego <[email protected]> Authored: Thu Jan 28 18:09:24 2016 +0300 Committer: isapego <[email protected]> Committed: Thu Jan 28 18:09:24 2016 +0300 ---------------------------------------------------------------------- .../platforms/cpp/odbc-test/src/cursor_test.cpp | 39 ++++++-------------- 1 file changed, 11 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/0b26795d/modules/platforms/cpp/odbc-test/src/cursor_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/cursor_test.cpp b/modules/platforms/cpp/odbc-test/src/cursor_test.cpp index 193f694..1771657 100644 --- a/modules/platforms/cpp/odbc-test/src/cursor_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/cursor_test.cpp @@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE(TestCursorLast) CheckCursorReady(cursor); - for (int32_t i = 0; i < pageSize - 1; ++i) + for (int32_t i = 0; i < pageSize; ++i) BOOST_REQUIRE(cursor.Increment()); CheckCursorEnd(cursor); @@ -144,10 +144,12 @@ BOOST_AUTO_TEST_CASE(TestCursorUpdate) BOOST_REQUIRE(cursor.GetQueryId() == testQueryId); - CheckCursorReady(cursor); + for (int32_t i = 0; i < pageSize; ++i) + { + CheckCursorReady(cursor); - for (int32_t i = 0; i < pageSize - 1; ++i) BOOST_REQUIRE(cursor.Increment()); + } CheckCursorNeedUpdate(cursor); @@ -157,8 +159,12 @@ BOOST_AUTO_TEST_CASE(TestCursorUpdate) CheckCursorReady(cursor); - for (int32_t i = 0; i < pageSize - 1; ++i) + for (int32_t i = 0; i < pageSize; ++i) + { + CheckCursorReady(cursor); + BOOST_REQUIRE(cursor.Increment()); + } CheckCursorEnd(cursor); } @@ -173,29 +179,6 @@ BOOST_AUTO_TEST_CASE(TestCursorUpdateOneRow) BOOST_REQUIRE(cursor.GetQueryId() == testQueryId); - CheckCursorNeedUpdate(cursor); - - BOOST_REQUIRE(!cursor.Increment()); - - resultPage = CreateTestPage(true, 1); - - cursor.UpdateData(resultPage); - - CheckCursorEnd(cursor); - - BOOST_REQUIRE(!cursor.Increment()); -} - -BOOST_AUTO_TEST_CASE(TestCursorUpdateTwoRows) -{ - Cursor cursor(testQueryId); - - std::auto_ptr<ResultPage> resultPage = CreateTestPage(false, 2); - - cursor.UpdateData(resultPage); - - BOOST_REQUIRE(cursor.GetQueryId() == testQueryId); - CheckCursorReady(cursor); BOOST_REQUIRE(cursor.Increment()); @@ -204,7 +187,7 @@ BOOST_AUTO_TEST_CASE(TestCursorUpdateTwoRows) BOOST_REQUIRE(!cursor.Increment()); - resultPage = CreateTestPage(true, 2); + resultPage = CreateTestPage(true, 1); cursor.UpdateData(resultPage);
