ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From isap...@apache.org
Subject [1/2] ignite git commit: IGNITE-4690: CPP: Added ignite::Time type
Date Tue, 21 Mar 2017 11:54:53 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 19ba8f477 -> 02991d306


http://git-wip-us.apache.org/repos/asf/ignite/blob/02991d30/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
index f2b3d33..9e610e6 100644
--- a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
@@ -171,216 +171,54 @@ void CheckRawPrimitiveArray(T dflt, T val1, T val2)
 
 void CheckRawWritesRestricted(BinaryRawWriter& writer)
 {
-    try
-    {
-        writer.WriteInt8(1);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        int8_t arr[1];
-
-        writer.WriteInt8Array(arr, 1);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        Guid val(1, 1);
-
-        writer.WriteGuid(val);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        Date val(1);
-
-        writer.WriteDate(val);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        Timestamp val(1);
-
-        writer.WriteTimestamp(val);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        writer.WriteString("test");
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try 
-    {
-        writer.WriteArray<int8_t>();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try 
-    {
-        writer.WriteCollection<int8_t>();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try 
-    {
-        writer.WriteMap<int8_t, int8_t>();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(writer.WriteInt8(1), IgniteError, IsBinaryError);
+
+    int8_t arr[1];
+    BOOST_CHECK_EXCEPTION(writer.WriteInt8Array(arr, 1), IgniteError, IsBinaryError);
+
+    Guid guid(1, 1);
+    BOOST_CHECK_EXCEPTION(writer.WriteGuid(guid), IgniteError, IsBinaryError);
+
+    Date date(1);
+    BOOST_CHECK_EXCEPTION(writer.WriteDate(date), IgniteError, IsBinaryError);
+
+    Time time(1);
+    BOOST_CHECK_EXCEPTION(writer.WriteTime(time), IgniteError, IsBinaryError);
+
+    Timestamp ts(1);
+    BOOST_CHECK_EXCEPTION(writer.WriteTimestamp(ts), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION(writer.WriteString("test"), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION(writer.WriteArray<int8_t>(), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION(writer.WriteCollection<int8_t>(), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION((writer.WriteMap<int8_t, int8_t>()), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION(writer.WriteInt8(1), IgniteError, IsBinaryError);
 }
 
 void CheckRawReadsRestricted(BinaryRawReader& reader)
 {
-    try
-    {
-        reader.ReadInt8();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        int8_t arr[1];
-
-        reader.ReadInt8Array(arr, 1);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadGuid();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadDate();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadTimestamp();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadString();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadArray<int8_t>();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadCollection<int8_t>();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadMap<int8_t, int8_t>();
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(reader.ReadInt8(), IgniteError, IsBinaryError);
+
+    int8_t arr[1];
+    BOOST_CHECK_EXCEPTION(reader.ReadInt8Array(arr, 1), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION(reader.ReadGuid(), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION(reader.ReadDate(), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION(reader.ReadTimestamp(), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION(reader.ReadString(), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION(reader.ReadArray<int8_t>(), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION(reader.ReadCollection<int8_t>(), IgniteError, IsBinaryError);
+
+    BOOST_CHECK_EXCEPTION((reader.ReadMap<int8_t, int8_t>()), IgniteError, IsBinaryError);
 }
 
 void CheckRawCollectionEmpty(CollectionType* colType)
@@ -400,27 +238,9 @@ void CheckRawCollectionEmpty(CollectionType* colType)
 
     rawWriter.WriteInt8(1);
 
-    try
-    {
-        colWriter.Write(1);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colWriter.Write(1), IgniteError, IsBinaryError);
 
-    try
-    {
-        colWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colWriter.Close(), IgniteError, IsBinaryError);
 
     out.Synchronize();
 
@@ -439,16 +259,7 @@ void CheckRawCollectionEmpty(CollectionType* colType)
     BOOST_REQUIRE(!colReader.HasNext());
     BOOST_REQUIRE(!colReader.IsNull());
 
-    try
-    {
-        colReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -478,27 +289,9 @@ void CheckRawCollection(CollectionType* colType)
 
     rawWriter.WriteInt8(1);
 
-    try
-    {
-        colWriter.Write(1);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colWriter.Write(1), IgniteError, IsBinaryError);
 
-    try
-    {
-        colWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colWriter.Close(), IgniteError, IsBinaryError);
 
     out.Synchronize();
 
@@ -529,16 +322,7 @@ void CheckRawCollection(CollectionType* colType)
 
     BOOST_REQUIRE(!colReader.HasNext());
 
-    try
-    {
-        colReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -609,27 +393,9 @@ void CheckRawMapEmpty(MapType* mapType)
 
     rawWriter.WriteInt8(1);
 
-    try
-    {
-        mapWriter.Write(1, BinaryInner(1));
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(mapWriter.Write(1, BinaryInner(1)), IgniteError, IsBinaryError);
 
-    try
-    {
-        mapWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(mapWriter.Close(), IgniteError, IsBinaryError);
 
     out.Synchronize();
 
@@ -648,19 +414,9 @@ void CheckRawMapEmpty(MapType* mapType)
     BOOST_REQUIRE(!mapReader.HasNext());
     BOOST_REQUIRE(!mapReader.IsNull());
 
-    try
-    {
-        int8_t key;
-        BinaryInner val;
-
-        mapReader.GetNext(&key, &val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    int8_t key;
+    BinaryInner val;
+    BOOST_CHECK_EXCEPTION(mapReader.GetNext(&key, &val), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -690,27 +446,9 @@ void CheckRawMap(MapType* mapType)
 
     rawWriter.WriteInt8(1);
 
-    try
-    {
-        mapWriter.Write(4, BinaryInner(4));
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        mapWriter.Close();
+    BOOST_CHECK_EXCEPTION(mapWriter.Write(4, BinaryInner(4)), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(mapWriter.Close(), IgniteError, IsBinaryError);
 
     out.Synchronize();
 
@@ -749,16 +487,7 @@ void CheckRawMap(MapType* mapType)
 
     BOOST_REQUIRE(!mapReader.HasNext());
 
-    try
-    {
-        mapReader.GetNext(&key, &val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(mapReader.GetNext(&key, &val), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -819,6 +548,13 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveDate)
     CheckRawPrimitive<Date>(val);
 }
 
+BOOST_AUTO_TEST_CASE(TestPrimitiveTime)
+{
+    Time val(time(NULL) * 1000);
+
+    CheckRawPrimitive<Time>(val);
+}
+
 BOOST_AUTO_TEST_CASE(TestPrimitiveTimestamp)
 {
     Timestamp val(time(NULL), 0);
@@ -884,6 +620,15 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveArrayDate)
     CheckRawPrimitiveArray<Date>(dflt, val1, val2);
 }
 
+BOOST_AUTO_TEST_CASE(TestPrimitiveArrayTime)
+{
+    Time dflt(1);
+    Time val1(2);
+    Time val2(3);
+
+    CheckRawPrimitiveArray<Time>(dflt, val1, val2);
+}
+
 BOOST_AUTO_TEST_CASE(TestPrimitiveArrayTimestamp)
 {
     Timestamp dflt(1);
@@ -937,6 +682,28 @@ BOOST_AUTO_TEST_CASE(TestDateNull)
     BOOST_REQUIRE(actualVal == expVal);
 }
 
+BOOST_AUTO_TEST_CASE(TestTimeNull)
+{
+    InteropUnpooledMemory mem(1024);
+
+    InteropOutputStream out(&mem);
+    BinaryWriterImpl writer(&out, NULL);
+    BinaryRawWriter rawWriter(&writer);
+
+    rawWriter.WriteNull();
+
+    out.Synchronize();
+
+    InteropInputStream in(&mem);
+    BinaryReaderImpl reader(&in);
+    BinaryRawReader rawReader(&reader);
+
+    Time expVal;
+    Time actualVal = rawReader.ReadTime();
+
+    BOOST_REQUIRE(actualVal == expVal);
+}
+
 BOOST_AUTO_TEST_CASE(TestTimestampNull)
 {
     InteropUnpooledMemory mem(1024);
@@ -1030,29 +797,10 @@ BOOST_AUTO_TEST_CASE(TestStringArrayNull)
     BOOST_REQUIRE(!arrReader.HasNext());
     BOOST_REQUIRE(arrReader.IsNull());
 
-    try
-    {
-        char res[100];
-
-        arrReader.GetNext(res, 100);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrReader.GetNext();
+    char res[100];
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(res, 100), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -1073,55 +821,14 @@ BOOST_AUTO_TEST_CASE(TestStringArrayEmpty)
 
     rawWriter.WriteInt8(1);
 
-    try
-    {
-        const char* val = "test";
+    const char* val1 = "test";
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val1, 4), IgniteError, IsBinaryError);
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val1), IgniteError, IsBinaryError);
 
-        arrWriter.Write(val, 4);
+    std::string val2 = "test";
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val2), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        const char* val = "test";
-
-        arrWriter.Write(val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        std::string val = "test";
-
-        arrWriter.Write(val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrWriter.Close(), IgniteError, IsBinaryError);
 
     out.Synchronize();
 
@@ -1135,29 +842,9 @@ BOOST_AUTO_TEST_CASE(TestStringArrayEmpty)
     BOOST_REQUIRE(!arrReader.HasNext());
     BOOST_REQUIRE(!arrReader.IsNull());
 
-    try
-    {
-        char res[100];
-
-        arrReader.GetNext(res, 100);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    char res[100];
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(res, 100), IgniteError, IsBinaryError);
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -1188,55 +875,14 @@ BOOST_AUTO_TEST_CASE(TestStringArray)
 
     rawWriter.WriteInt8(1);
 
-    try
-    {
-        const char* val = "test";
+    const char* val1 = "test";
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val1, 4), IgniteError, IsBinaryError);
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val1), IgniteError, IsBinaryError);
 
-        arrWriter.Write(val, 4);
+    std::string val2 = "test";
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val2), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        const char* val = "test";
-
-        arrWriter.Write(val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        std::string val = "test";
-
-        arrWriter.Write(val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrWriter.Close(), IgniteError, IsBinaryError);
 
     out.Synchronize();
 
@@ -1298,29 +944,9 @@ BOOST_AUTO_TEST_CASE(TestStringArray)
 
     BOOST_REQUIRE(!arrReader.HasNext());
 
-    try
-    {
-        char res[100];
-
-        arrReader.GetNext(res, 100);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    char res[100];
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(res, 100), IgniteError, IsBinaryError);
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -1413,16 +1039,7 @@ BOOST_AUTO_TEST_CASE(TestArrayNull)
     BOOST_REQUIRE(!arrReader.HasNext());
     BOOST_REQUIRE(arrReader.IsNull());
 
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -1443,27 +1060,9 @@ BOOST_AUTO_TEST_CASE(TestArrayEmpty)
 
     rawWriter.WriteInt8(1);
 
-    try
-    {
-        arrWriter.Write(1);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrWriter.Close();
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(1), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrWriter.Close(), IgniteError, IsBinaryError);
 
     out.Synchronize();
 
@@ -1477,16 +1076,7 @@ BOOST_AUTO_TEST_CASE(TestArrayEmpty)
     BOOST_REQUIRE(!arrReader.HasNext());
     BOOST_REQUIRE(!arrReader.IsNull());
 
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -1515,27 +1105,9 @@ BOOST_AUTO_TEST_CASE(TestArray)
 
     rawWriter.WriteInt8(1);
 
-    try
-    {
-        arrWriter.Write(1);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrWriter.Close();
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(1), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrWriter.Close(), IgniteError, IsBinaryError);
 
     out.Synchronize();
 
@@ -1561,16 +1133,7 @@ BOOST_AUTO_TEST_CASE(TestArray)
 
     BOOST_REQUIRE(!arrReader.HasNext());
 
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -1599,16 +1162,7 @@ BOOST_AUTO_TEST_CASE(TestCollectionNull)
     BOOST_REQUIRE(!colReader.HasNext());
     BOOST_REQUIRE(colReader.IsNull()); 
 
-    try
-    {
-        colReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }
@@ -1673,19 +1227,9 @@ BOOST_AUTO_TEST_CASE(TestMapNull)
     BOOST_REQUIRE(!mapReader.HasNext());
     BOOST_REQUIRE(mapReader.IsNull());
 
-    try
-    {
-        int8_t key;
-        BinaryInner val;
-
-        mapReader.GetNext(&key, &val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    int8_t key;
+    BinaryInner val;
+    BOOST_CHECK_EXCEPTION(mapReader.GetNext(&key, &val), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/02991d30/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
index dd5743a..3115764 100644
--- a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
@@ -46,16 +46,7 @@ void CheckPrimitive(T val)
     BinaryWriterImpl writerImpl(&out, &idRslvr, NULL, NULL, 0);
     BinaryWriter writer(&writerImpl);
 
-    try
-    {
-        Write<T>(writer, NULL, val);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(Write<T>(writer, NULL, val), IgniteError, IsBinaryError);
 
     Write<T>(writer, "test", val);
 
@@ -73,27 +64,11 @@ void CheckPrimitive(T val)
     BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
     BinaryReader reader(&readerImpl);
 
-    try
-    {
-        Read<T>(reader, NULL);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(Read<T>(reader, NULL), IgniteError, IsBinaryError);
 
-    try
-    {
-        T readVal = Read<T>(reader, "test"); 
+    T readVal = Read<T>(reader, "test"); 
 
-        BOOST_REQUIRE(readVal == val);
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_FAIL(err.GetText());
-    }
+    BOOST_REQUIRE(readVal == val);
 }
 
 template<typename T>
@@ -111,21 +86,12 @@ void CheckPrimitiveArray(T dflt, T val1, T val2)
 
     out.Position(IGNITE_DFLT_HDR_LEN);
 
-    try
-    {
-        T nullFieldArr[2];
+    T nullFieldArr[2];
 
-        nullFieldArr[0] = val1;
-        nullFieldArr[1] = val2;
+    nullFieldArr[0] = val1;
+    nullFieldArr[1] = val2;
 
-        WriteArray<T>(writer, NULL, nullFieldArr, 2);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(WriteArray<T>(writer, NULL, nullFieldArr, 2), IgniteError, IsBinaryError);
 
     T arr1[2];
     arr1[0] = dflt;
@@ -269,16 +235,7 @@ void CheckPrimitiveArray(T dflt, T val1, T val2)
         in.Position(IGNITE_DFLT_HDR_LEN);
         BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 2) == 2);
 
-        try
-        {
-            ReadArray<T>(reader, NULL, arr1, 2);
-
-            BOOST_FAIL("Not restricted.");
-        }
-        catch (IgniteError& err)
-        {
-            BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-        }
+        BOOST_CHECK_EXCEPTION(ReadArray<T>(reader, NULL, arr1, 2), IgniteError, IsBinaryError);
 
         BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 0) == 2);
         BOOST_REQUIRE(arr1[0] == dflt);
@@ -296,216 +253,52 @@ void CheckPrimitiveArray(T dflt, T val1, T val2)
 
 void CheckWritesRestricted(BinaryWriter& writer)
 {
-    try
-    {
-        writer.WriteInt8("field", 1);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        int8_t arr[1];
+    BOOST_CHECK_EXCEPTION(writer.WriteInt8("field", 1), IgniteError, IsBinaryError);
 
-        writer.WriteInt8Array("field", arr, 1);
+    int8_t arr[1];
+    BOOST_CHECK_EXCEPTION(writer.WriteInt8Array("field", arr, 1), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        Guid val(1, 1);
-
-        writer.WriteGuid("field", val);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        Date val(1);
-
-        writer.WriteDate("field", val);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        Timestamp val(1);
-
-        writer.WriteTimestamp("field", val);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        writer.WriteString("field", "test");
+    Guid guid(1, 1);
+    BOOST_CHECK_EXCEPTION(writer.WriteGuid("field", guid), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    Date date(1);
+    BOOST_CHECK_EXCEPTION(writer.WriteDate("field", date), IgniteError, IsBinaryError);
 
-    try 
-    {
-        writer.WriteArray<int8_t>("field");
+    Time time(1);
+    BOOST_CHECK_EXCEPTION(writer.WriteTime("field", time), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    Timestamp ts(1);
+    BOOST_CHECK_EXCEPTION(writer.WriteTimestamp("field", ts), IgniteError, IsBinaryError);
 
-    try 
-    {
-        writer.WriteCollection<int8_t>("field");
+    BOOST_CHECK_EXCEPTION(writer.WriteString("field", "test"), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(writer.WriteArray<int8_t>("field"), IgniteError, IsBinaryError);
 
-    try 
-    {
-        writer.WriteMap<int8_t, int8_t>("field");
+    BOOST_CHECK_EXCEPTION(writer.WriteCollection<int8_t>("field"), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION((writer.WriteMap<int8_t, int8_t>("field")), IgniteError, IsBinaryError);
 }
 
 void CheckReadsRestricted(BinaryReader& reader)
 {
-    try
-    {
-        reader.ReadInt8("field");
+    BOOST_CHECK_EXCEPTION(reader.ReadInt8("field"), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    int8_t arr[1];
+    BOOST_CHECK_EXCEPTION(reader.ReadInt8Array("field", arr, 1), IgniteError, IsBinaryError);
 
-    try
-    {
-        int8_t arr[1];
+    BOOST_CHECK_EXCEPTION(reader.ReadGuid("field"), IgniteError, IsBinaryError);
 
-        reader.ReadInt8Array("field", arr, 1);
+    BOOST_CHECK_EXCEPTION(reader.ReadDate("field"), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(reader.ReadTimestamp("field"), IgniteError, IsBinaryError);
 
-    try
-    {
-        reader.ReadGuid("field");
+    BOOST_CHECK_EXCEPTION(reader.ReadString("field"), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(reader.ReadArray<int8_t>("field"), IgniteError, IsBinaryError);
 
-    try
-    {
-        reader.ReadDate("field");
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadTimestamp("field");
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadString("field");
+    BOOST_CHECK_EXCEPTION(reader.ReadCollection<int8_t>("field"), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadArray<int8_t>("field");
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadCollection<int8_t>("field");
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadMap<int8_t, int8_t>("field");
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION((reader.ReadMap<int8_t, int8_t>("field")), IgniteError, IsBinaryError);
 }
 
 void CheckCollectionEmpty(CollectionType* colType)
@@ -529,27 +322,9 @@ void CheckCollectionEmpty(CollectionType* colType)
 
     writer.WriteInt8("field2", 1);
 
-    try
-    {
-        colWriter.Write(1);
+    BOOST_CHECK_EXCEPTION(colWriter.Write(1), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        colWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colWriter.Close(), IgniteError, IsBinaryError);
 
     writerImpl.PostWrite();
 
@@ -575,17 +350,8 @@ void CheckCollectionEmpty(CollectionType* colType)
     BOOST_REQUIRE(colReader.GetSize() == 0);
     BOOST_REQUIRE(!colReader.HasNext());
     BOOST_REQUIRE(!colReader.IsNull());
-
-    try
-    {
-        colReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    
+    BOOST_CHECK_EXCEPTION(colReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -619,27 +385,9 @@ void CheckCollection(CollectionType* colType)
 
     writer.WriteInt8("field2", 1);
 
-    try
-    {
-        colWriter.Write(1);
+    BOOST_CHECK_EXCEPTION(colWriter.Write(1), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        colWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colWriter.Close(), IgniteError, IsBinaryError);
 
     writerImpl.PostWrite();
 
@@ -678,16 +426,7 @@ void CheckCollection(CollectionType* colType)
 
     BOOST_REQUIRE(!colReader.HasNext());
 
-    try
-    {
-        colReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -772,27 +511,9 @@ void CheckMapEmpty(MapType* mapType)
 
     writer.WriteInt8("field2", 1);
 
-    try
-    {
-        mapWriter.Write(1, BinaryInner(1));
+    BOOST_CHECK_EXCEPTION(mapWriter.Write(1, BinaryInner(1)), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        mapWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(mapWriter.Close(), IgniteError, IsBinaryError);
 
     writerImpl.PostWrite();
 
@@ -819,19 +540,9 @@ void CheckMapEmpty(MapType* mapType)
     BOOST_REQUIRE(!mapReader.HasNext());
     BOOST_REQUIRE(!mapReader.IsNull());
 
-    try
-    {
-        int8_t key;
-        BinaryInner val;
-
-        mapReader.GetNext(&key, &val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    int8_t key;
+    BinaryInner val;
+    BOOST_CHECK_EXCEPTION(mapReader.GetNext(&key, &val), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -865,27 +576,9 @@ void CheckMap(MapType* mapType)
 
     writer.WriteInt8("field2", 1);
 
-    try
-    {
-        mapWriter.Write(4, BinaryInner(4));
+    BOOST_CHECK_EXCEPTION(mapWriter.Write(4, BinaryInner(4)), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        mapWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(mapWriter.Close(), IgniteError, IsBinaryError);
 
     writerImpl.PostWrite();
 
@@ -932,16 +625,7 @@ void CheckMap(MapType* mapType)
 
     BOOST_REQUIRE(!mapReader.HasNext());
 
-    try
-    {
-        mapReader.GetNext(&key, &val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(mapReader.GetNext(&key, &val), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -1002,6 +686,13 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveDate)
     CheckPrimitive<Date>(val);
 }
 
+BOOST_AUTO_TEST_CASE(TestPrimitiveTime)
+{
+    Time val(time(NULL) * 1000);
+
+    CheckPrimitive<Time>(val);
+}
+
 BOOST_AUTO_TEST_CASE(TestPrimitiveTimestamp)
 {
     Timestamp val(time(NULL), 0);
@@ -1067,6 +758,15 @@ BOOST_AUTO_TEST_CASE(TestPrimitiveArrayDate)
     CheckPrimitiveArray<Date>(dflt, val1, val2);
 }
 
+BOOST_AUTO_TEST_CASE(TestPrimitiveArrayTime)
+{
+    Time dflt(1);
+    Time val1(2);
+    Time val2(3);
+
+    CheckPrimitiveArray<Time>(dflt, val1, val2);
+}
+
 BOOST_AUTO_TEST_CASE(TestPrimitiveArrayTimestamp)
 {
     Timestamp dflt(1);
@@ -1088,16 +788,7 @@ BOOST_AUTO_TEST_CASE(TestGuidNull)
 
     out.Position(IGNITE_DFLT_HDR_LEN);
 
-    try
-    {
-        writer.WriteNull(NULL);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(writer.WriteNull(NULL), IgniteError, IsBinaryError);
 
     writer.WriteNull("test");
 
@@ -1115,16 +806,7 @@ BOOST_AUTO_TEST_CASE(TestGuidNull)
     
     in.Position(IGNITE_DFLT_HDR_LEN);
 
-    try
-    {
-        reader.ReadGuid(NULL);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(reader.ReadGuid(NULL), IgniteError, IsBinaryError);
 
     Guid expVal;
     Guid actualVal = reader.ReadGuid("test");
@@ -1144,16 +826,7 @@ BOOST_AUTO_TEST_CASE(TestDateNull)
 
     out.Position(IGNITE_DFLT_HDR_LEN);
 
-    try
-    {
-        writer.WriteNull(NULL);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(writer.WriteNull(NULL), IgniteError, IsBinaryError);
 
     writer.WriteNull("test");
 
@@ -1171,16 +844,7 @@ BOOST_AUTO_TEST_CASE(TestDateNull)
     
     in.Position(IGNITE_DFLT_HDR_LEN);
 
-    try
-    {
-        reader.ReadDate(NULL);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(reader.ReadDate(NULL), IgniteError, IsBinaryError);
 
     Date expVal;
     Date actualVal = reader.ReadDate("test");
@@ -1188,7 +852,7 @@ BOOST_AUTO_TEST_CASE(TestDateNull)
     BOOST_REQUIRE(actualVal == expVal);
 }
 
-BOOST_AUTO_TEST_CASE(TestTimestampNull)
+BOOST_AUTO_TEST_CASE(TestTimeNull)
 {
     TemplatedBinaryIdResolver<BinaryDummy> idRslvr;
 
@@ -1200,16 +864,7 @@ BOOST_AUTO_TEST_CASE(TestTimestampNull)
 
     out.Position(IGNITE_DFLT_HDR_LEN);
 
-    try
-    {
-        writer.WriteNull(NULL);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(writer.WriteNull(NULL), IgniteError, IsBinaryError);
 
     writer.WriteNull("test");
 
@@ -1227,16 +882,45 @@ BOOST_AUTO_TEST_CASE(TestTimestampNull)
 
     in.Position(IGNITE_DFLT_HDR_LEN);
 
-    try
-    {
-        reader.ReadTimestamp(NULL);
+    BOOST_CHECK_EXCEPTION(reader.ReadTime(NULL), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    Time expVal;
+    Time actualVal = reader.ReadTime("test");
+
+    BOOST_REQUIRE(actualVal == expVal);
+}
+
+BOOST_AUTO_TEST_CASE(TestTimestampNull)
+{
+    TemplatedBinaryIdResolver<BinaryDummy> idRslvr;
+
+    InteropUnpooledMemory mem(1024);
+
+    InteropOutputStream out(&mem);
+    BinaryWriterImpl writerImpl(&out, &idRslvr, NULL, NULL, 0);
+    BinaryWriter writer(&writerImpl);
+
+    out.Position(IGNITE_DFLT_HDR_LEN);
+
+    BOOST_CHECK_EXCEPTION(writer.WriteNull(NULL), IgniteError, IsBinaryError);
+
+    writer.WriteNull("test");
+
+    writerImpl.PostWrite();
+
+    out.Synchronize();
+
+    InteropInputStream in(&mem);
+
+    int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF);
+    int32_t footerEnd = footerBegin + 5;
+
+    BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE);
+    BinaryReader reader(&readerImpl);
+
+    in.Position(IGNITE_DFLT_HDR_LEN);
+
+    BOOST_CHECK_EXCEPTION(reader.ReadTimestamp(NULL), IgniteError, IsBinaryError);
 
     Timestamp expVal;
     Timestamp actualVal = reader.ReadTimestamp("test");
@@ -1259,38 +943,11 @@ BOOST_AUTO_TEST_CASE(TestString) {
     const char* writeVal2 = "test";
     std::string writeVal3 = writeVal1;
 
-    try
-    {
-        writer.WriteString(NULL, writeVal1);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(writer.WriteString(NULL, writeVal1), IgniteError, IsBinaryError);
 
-    try
-    {
-        writer.WriteString(NULL, writeVal1, 4);
+    BOOST_CHECK_EXCEPTION(writer.WriteString(NULL, writeVal1, 4), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        writer.WriteString(NULL, writeVal3);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(writer.WriteString(NULL, writeVal3), IgniteError, IsBinaryError);
 
     writer.WriteString("field1", writeVal1);
     writer.WriteString("field2", writeVal1, 4);
@@ -1312,29 +969,10 @@ BOOST_AUTO_TEST_CASE(TestString) {
 
     in.Position(IGNITE_DFLT_HDR_LEN);
 
-    try
-    {
-        char nullCheckRes[9];
-
-        reader.ReadString(NULL, nullCheckRes, 9);
-
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        reader.ReadString(NULL);
+    char nullCheckRes[9];
+    BOOST_CHECK_EXCEPTION(reader.ReadString(NULL, nullCheckRes, 9), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Not restricted.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(reader.ReadString(NULL), IgniteError, IsBinaryError);
 
     char readVal1[9];
     char readVal2[5];
@@ -1396,29 +1034,9 @@ BOOST_AUTO_TEST_CASE(TestStringArrayNull)
     BOOST_REQUIRE(!arrReader.HasNext());
     BOOST_REQUIRE(arrReader.IsNull());
 
-    try
-    {
-        char res[100];
-
-        arrReader.GetNext(res, 100);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    char res[100];
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(res, 100), IgniteError, IsBinaryError);
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -1443,55 +1061,14 @@ BOOST_AUTO_TEST_CASE(TestStringArrayEmpty)
 
     writer.WriteInt8("field2", 1);
 
-    try
-    {
-        const char* val = "test";
+    const char* val1 = "test";
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val1, 4), IgniteError, IsBinaryError);
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val1), IgniteError, IsBinaryError);
 
-        arrWriter.Write(val, 4);
+    std::string val2 = "test";
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val2), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        const char* val = "test";
-
-        arrWriter.Write(val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        std::string val = "test";
-
-        arrWriter.Write(val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrWriter.Close(), IgniteError, IsBinaryError);
 
     writerImpl.PostWrite();
 
@@ -1513,29 +1090,10 @@ BOOST_AUTO_TEST_CASE(TestStringArrayEmpty)
     BOOST_REQUIRE(!arrReader.HasNext());
     BOOST_REQUIRE(!arrReader.IsNull());
 
-    try
-    {
-        char res[100];
-
-        arrReader.GetNext(res, 100);
+    char res[100];
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(res, 100), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -1570,55 +1128,14 @@ BOOST_AUTO_TEST_CASE(TestStringArray)
 
     writer.WriteInt8("field2", 1);
 
-    try
-    {
-        const char* val = "test";
-
-        arrWriter.Write(val, 4);
+    const char* val1 = "test";
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val1, 4), IgniteError, IsBinaryError);
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val1), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    std::string val2 = "test";
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(val2), IgniteError, IsBinaryError);
 
-    try
-    {
-        const char* val = "test";
-
-        arrWriter.Write(val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        std::string val = "test";
-
-        arrWriter.Write(val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrWriter.Close(), IgniteError, IsBinaryError);
 
     writerImpl.PostWrite();
 
@@ -1688,29 +1205,10 @@ BOOST_AUTO_TEST_CASE(TestStringArray)
 
     BOOST_REQUIRE(!arrReader.HasNext());
 
-    try
-    {
-        char res[100];
+    char res[100];
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(res, 100), IgniteError, IsBinaryError);
 
-        arrReader.GetNext(res, 100);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -1840,16 +1338,7 @@ BOOST_AUTO_TEST_CASE(TestArrayNull)
     BOOST_REQUIRE(!arrReader.HasNext());
     BOOST_REQUIRE(arrReader.IsNull());
 
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -1874,27 +1363,9 @@ BOOST_AUTO_TEST_CASE(TestArrayEmpty)
 
     writer.WriteInt8("field2", 1);
 
-    try
-    {
-        arrWriter.Write(1);
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(1), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrWriter.Close();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrWriter.Close(), IgniteError, IsBinaryError);
 
     writerImpl.PostWrite();
 
@@ -1916,16 +1387,7 @@ BOOST_AUTO_TEST_CASE(TestArrayEmpty)
     BOOST_REQUIRE(!arrReader.HasNext());
     BOOST_REQUIRE(!arrReader.IsNull());
 
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -1958,27 +1420,9 @@ BOOST_AUTO_TEST_CASE(TestArray)
 
     writer.WriteInt8("field2", 1);
 
-    try
-    {
-        arrWriter.Write(1);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
-
-    try
-    {
-        arrWriter.Close();
+    BOOST_CHECK_EXCEPTION(arrWriter.Write(1), IgniteError, IsBinaryError);
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrWriter.Close(), IgniteError, IsBinaryError);
 
     writerImpl.PostWrite();
 
@@ -2012,16 +1456,7 @@ BOOST_AUTO_TEST_CASE(TestArray)
 
     BOOST_REQUIRE(!arrReader.HasNext());
 
-    try
-    {
-        arrReader.GetNext();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(arrReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -2060,18 +1495,9 @@ BOOST_AUTO_TEST_CASE(TestCollectionNull)
     BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED);
     BOOST_REQUIRE(colReader.GetSize() == -1);
     BOOST_REQUIRE(!colReader.HasNext());
-    BOOST_REQUIRE(colReader.IsNull()); 
-
-    try
-    {
-        colReader.GetNext();
+    BOOST_REQUIRE(colReader.IsNull());
 
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(colReader.GetNext(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -2148,19 +1574,9 @@ BOOST_AUTO_TEST_CASE(TestMapNull)
     BOOST_REQUIRE(!mapReader.HasNext());
     BOOST_REQUIRE(mapReader.IsNull());
 
-    try
-    {
-        int8_t key;
-        BinaryInner val;
-
-        mapReader.GetNext(&key, &val);
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    int8_t key;
+    BinaryInner val;
+    BOOST_CHECK_EXCEPTION(mapReader.GetNext(&key, &val), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
 }
@@ -2203,16 +1619,7 @@ BOOST_AUTO_TEST_CASE(TestRawMode)
 
     BinaryRawWriter rawWriter = writer.RawWriter();
 
-    try
-    {
-        writer.RawWriter();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(writer.RawWriter(), IgniteError, IsBinaryError);
 
     rawWriter.WriteInt8(1);
 
@@ -2234,16 +1641,7 @@ BOOST_AUTO_TEST_CASE(TestRawMode)
 
     BinaryRawReader rawReader = reader.RawReader();
 
-    try
-    {
-        reader.RawReader();
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(reader.RawReader(), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(rawReader.ReadInt8() == 1);
 
@@ -2345,16 +1743,7 @@ BOOST_AUTO_TEST_CASE(TestFieldSeek)
     in.Position(IGNITE_DFLT_HDR_LEN);
     BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
 
-    try
-    {
-        reader.ReadInt64("val2");
-
-        BOOST_FAIL("Error expected.");
-    }
-    catch (IgniteError& err)
-    {
-        BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_BINARY);
-    }
+    BOOST_CHECK_EXCEPTION(reader.ReadInt64("val2"), IgniteError, IsBinaryError);
 
     BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/02991d30/modules/platforms/cpp/core-test/src/binary_session_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_session_test.cpp b/modules/platforms/cpp/core-test/src/binary_session_test.cpp
index 0b9b34d..08bc1eb 100644
--- a/modules/platforms/cpp/core-test/src/binary_session_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_session_test.cpp
@@ -155,6 +155,24 @@ BOOST_AUTO_TEST_CASE(TestDate)
     BOOST_REQUIRE(readVal == writeVal);
 }
 
+BOOST_AUTO_TEST_CASE(TestTime)
+{
+    Time writeVal = Time(42);
+
+    InteropUnpooledMemory mem(1024);
+
+    InteropOutputStream out(&mem);
+    BinaryWriterImpl writeSes(&out, NULL);
+    writeSes.WriteTopObject<Time>(writeVal);
+    out.Synchronize();
+
+    InteropInputStream in(&mem);
+    BinaryReaderImpl reader(&in);
+    Time readVal = reader.ReadTopObject<Time>();
+
+    BOOST_REQUIRE(readVal == writeVal);
+}
+
 BOOST_AUTO_TEST_CASE(TestTimestamp)
 {
     Timestamp writeVal = Timestamp(77);

http://git-wip-us.apache.org/repos/asf/ignite/blob/02991d30/modules/platforms/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_query_test.cpp b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
index 28eb3fd..abb374a 100644
--- a/modules/platforms/cpp/core-test/src/cache_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
@@ -1130,30 +1130,23 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryExceptions)
 
     cursor = cache.Query(qry);
 
-    try
-    {
-        BOOST_REQUIRE(cursor.HasNext());
+    BOOST_REQUIRE(cursor.HasNext());
 
-        QueryFieldsRow row = cursor.GetNext();
+    QueryFieldsRow row = cursor.GetNext();
 
-        BOOST_REQUIRE(row.HasNext());
+    BOOST_REQUIRE(row.HasNext());
 
-        int age = row.GetNext<int>();
+    int age = row.GetNext<int>();
 
-        BOOST_REQUIRE(age == 10);
+    BOOST_REQUIRE(age == 10);
 
-        std::string name = row.GetNext<std::string>();
+    std::string name = row.GetNext<std::string>();
 
-        BOOST_REQUIRE(name == "A1");
+    BOOST_REQUIRE(name == "A1");
 
-        BOOST_REQUIRE(!row.HasNext());
+    BOOST_REQUIRE(!row.HasNext());
 
-        CheckEmpty(cursor);
-    }
-    catch (IgniteError& error)
-    {
-        BOOST_FAIL(error.GetText());
-    }
+    CheckEmpty(cursor);
 }
 
 /**
@@ -1639,6 +1632,46 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampEqual)
 }
 
 /**
+ * Test query for Time type.
+ */
+BOOST_AUTO_TEST_CASE(TestFieldsQueryTimeEqual)
+{
+    // Test simple query.
+    Cache<int, Time> cache = grid.GetOrCreateCache<int, Time>("TimeCache");
+
+    // Test query with field of type 'Timestamp'.
+    SqlFieldsQuery qry("select _key from Time where _val='04:11:02'");
+
+    QueryFieldsCursor cursor = cache.Query(qry);
+    CheckEmpty(cursor);
+
+    int32_t entryCnt = 1000; // Number of entries.
+
+    for (int i = 0; i < entryCnt; i++)
+    {
+        int secs = i % 60;
+        int mins = i / 60;
+        cache.Put(i, MakeTimeGmt(4, mins, secs));
+    }
+
+    cursor = cache.Query(qry);
+
+    BOOST_REQUIRE(cursor.HasNext());
+
+    QueryFieldsRow row = cursor.GetNext();
+
+    BOOST_REQUIRE(row.HasNext());
+
+    int key = row.GetNext<int>();
+
+    BOOST_CHECK(key == 662);
+
+    BOOST_REQUIRE(!row.HasNext());
+
+    CheckEmpty(cursor);
+}
+
+/**
  * Test fields query with several pages.
  */
 BOOST_AUTO_TEST_CASE(TestFieldsQueryPagesSeveral)

http://git-wip-us.apache.org/repos/asf/ignite/blob/02991d30/modules/platforms/cpp/core-test/src/cache_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_test.cpp b/modules/platforms/cpp/core-test/src/cache_test.cpp
index f38eecc..437ed234 100644
--- a/modules/platforms/cpp/core-test/src/cache_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_test.cpp
@@ -452,6 +452,18 @@ BOOST_AUTO_TEST_CASE(TestPutGetDate)
     BOOST_REQUIRE(now == cache.Get(5));
 }
 
+BOOST_AUTO_TEST_CASE(TestPutGetTime)
+{
+    // Get existing cache
+    cache::Cache<int, Time> cache = grid0.GetOrCreateCache<int, Time>("partitioned");
+
+    Time now = Time(time(NULL) * 1000);
+
+    cache.Put(5, now);
+
+    BOOST_REQUIRE(now == cache.Get(5));
+}
+
 BOOST_AUTO_TEST_CASE(TestPutGetTimestamp)
 {
     // Get existing cache

http://git-wip-us.apache.org/repos/asf/ignite/blob/02991d30/modules/platforms/cpp/core-test/src/date_time_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/date_time_test.cpp b/modules/platforms/cpp/core-test/src/date_time_test.cpp
new file mode 100644
index 0000000..0c93a17
--- /dev/null
+++ b/modules/platforms/cpp/core-test/src/date_time_test.cpp
@@ -0,0 +1,265 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _MSC_VER
+#   define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+
+#include <ignite/time.h>
+#include <ignite/date.h>
+#include <ignite/timestamp.h>
+
+#include <ignite/common/utils.h>
+
+#include <ignite/test_utils.h>
+
+using namespace ignite;
+using namespace cache;
+using namespace boost::unit_test;
+
+/**
+ * Check operators for type.
+ * All args should refer to a different instances.
+ * Also, val1 should be less then val2 and equeal val3.
+ */
+template<typename T>
+void CheckOperators(const T& val1, const T& val2, const T& val3)
+{
+    BOOST_CHECK(&val1 != &val2);
+    BOOST_CHECK(&val1 != &val3);
+    BOOST_CHECK(&val2 != &val3);
+
+    BOOST_CHECK(val1 == val1);
+    BOOST_CHECK(val2 == val2);
+
+    BOOST_CHECK(val1 == val3);
+    BOOST_CHECK(val3 == val1);
+
+    BOOST_CHECK(val1 != val2);
+    BOOST_CHECK(val2 != val1);
+    BOOST_CHECK(val3 != val2);
+    BOOST_CHECK(val2 != val3);
+
+    BOOST_CHECK(val1 < val2);
+    BOOST_CHECK(val3 < val2);
+
+    BOOST_CHECK(val1 <= val2);
+    BOOST_CHECK(val3 <= val2);
+    BOOST_CHECK(val1 <= val1);
+    BOOST_CHECK(val2 <= val2);
+    BOOST_CHECK(val1 <= val3);
+    BOOST_CHECK(val3 <= val1);
+
+    BOOST_CHECK(val2 > val1);
+    BOOST_CHECK(val2 > val3);
+
+    BOOST_CHECK(val2 >= val1);
+    BOOST_CHECK(val2 >= val3);
+    BOOST_CHECK(val1 >= val1);
+    BOOST_CHECK(val2 >= val2);
+    BOOST_CHECK(val1 >= val3);
+    BOOST_CHECK(val3 >= val1);
+}
+
+void CheckDate(int year, int mon, int day)
+{
+    Date date = common::MakeDateGmt(year, mon, day);
+    tm res;
+
+    common::DateToCTm(date, res);
+
+    BOOST_CHECK_EQUAL(res.tm_year + 1900, year);
+    BOOST_CHECK_EQUAL(res.tm_mon + 1, mon);
+    BOOST_CHECK_EQUAL(res.tm_mday, day);
+}
+
+void CheckTimestamp(int year, int mon, int day, int hour, int mins, int sec, int ns)
+{
+    Timestamp ts = common::MakeTimestampGmt(year, mon, day, hour, mins, sec, ns);
+    tm res;
+
+    common::TimestampToCTm(ts, res);
+
+    BOOST_CHECK_EQUAL(res.tm_year + 1900, year);
+    BOOST_CHECK_EQUAL(res.tm_mon + 1, mon);
+    BOOST_CHECK_EQUAL(res.tm_mday, day);
+    BOOST_CHECK_EQUAL(res.tm_hour, hour);
+    BOOST_CHECK_EQUAL(res.tm_min, mins);
+    BOOST_CHECK_EQUAL(res.tm_sec, sec);
+}
+
+BOOST_AUTO_TEST_SUITE(DateTimeTestSuite)
+
+BOOST_AUTO_TEST_CASE(TimeOperators1)
+{
+    Time val1(1);
+    Time val2(2);
+    Time val3(1);
+
+    CheckOperators(val1, val2, val3);
+}
+
+BOOST_AUTO_TEST_CASE(TimeOperators2)
+{
+    Time val1(154362);
+    Time val2(val1.GetMilliseconds() + 42363);
+    Time val3(val1);
+
+    CheckOperators(val1, val2, val3);
+}
+
+BOOST_AUTO_TEST_CASE(DateOperators1)
+{
+    Date val1(1);
+    Date val2(2);
+    Date val3(1);
+
+    CheckOperators(val1, val2, val3);
+}
+
+BOOST_AUTO_TEST_CASE(DateOperators2)
+{
+    Date val1(154362);
+    Date val2(val1.GetMilliseconds() + 42363);
+    Date val3(val1);
+
+    CheckOperators(val1, val2, val3);
+}
+
+BOOST_AUTO_TEST_CASE(TimestampOperators1)
+{
+    Timestamp val1(1);
+    Timestamp val2(2);
+    Timestamp val3(1);
+
+    CheckOperators(val1, val2, val3);
+}
+
+BOOST_AUTO_TEST_CASE(TimestampOperators2)
+{
+    Timestamp val1(154362);
+    Timestamp val2(val1.GetMilliseconds() + 42363);
+    Timestamp val3(val1);
+
+    CheckOperators(val1, val2, val3);
+}
+
+BOOST_AUTO_TEST_CASE(TimestampOperators3)
+{
+    Timestamp val1(42, 1);
+    Timestamp val2(42, 2);
+    Timestamp val3(42, 1);
+
+    CheckOperators(val1, val2, val3);
+}
+
+BOOST_AUTO_TEST_CASE(TimestampOperators4)
+{
+    Timestamp val1(42, 154362);
+    Timestamp val2(42, val1.GetSecondFraction() + 42363);
+    Timestamp val3(42, val1.GetSecondFraction());
+
+    CheckOperators(val1, val2, val3);
+}
+
+BOOST_AUTO_TEST_CASE(TimestampOperators5)
+{
+    Timestamp val1(154362, 154362);
+    Timestamp val2(val1.GetMilliseconds() + 42363, val1.GetSecondFraction() + 42363);
+    Timestamp val3(val1);
+
+    CheckOperators(val1, val2, val3);
+}
+
+BOOST_AUTO_TEST_CASE(MakeTime)
+{
+    using namespace common;
+
+    BOOST_CHECK_EQUAL(MakeTimeGmt(0, 0, 0).GetMilliseconds(), 0);
+    BOOST_CHECK_EQUAL(MakeTimeGmt(23, 59, 59).GetMilliseconds(), 86399000);
+    BOOST_CHECK_EQUAL(MakeTimeGmt(14, 23, 47).GetMilliseconds(), 51827000);
+    BOOST_CHECK_EQUAL(MakeTimeGmt(0, 24, 12).GetMilliseconds(), 1452000);
+    BOOST_CHECK_EQUAL(MakeTimeGmt(8, 0, 0).GetMilliseconds(), 28800000);
+
+    BOOST_CHECK_EQUAL(MakeTimeGmt(0, 0, 0).GetSeconds(), 0);
+    BOOST_CHECK_EQUAL(MakeTimeGmt(23, 59, 59).GetSeconds(), 86399);
+    BOOST_CHECK_EQUAL(MakeTimeGmt(14, 23, 47).GetSeconds(), 51827);
+    BOOST_CHECK_EQUAL(MakeTimeGmt(0, 24, 12).GetSeconds(), 1452);
+    BOOST_CHECK_EQUAL(MakeTimeGmt(8, 0, 0).GetSeconds(), 28800);
+}
+
+BOOST_AUTO_TEST_CASE(MakeDate)
+{
+    using namespace common;
+
+    BOOST_CHECK_EQUAL(MakeDateGmt(1970, 1, 1).GetMilliseconds(), 0);
+    BOOST_CHECK_EQUAL(MakeDateGmt(2000, 12, 31).GetMilliseconds(), 978220800000);
+    BOOST_CHECK_EQUAL(MakeDateGmt(2017, 3, 20).GetMilliseconds(), 1489968000000);
+
+    BOOST_CHECK_EQUAL(MakeDateGmt(1970, 1, 1).GetSeconds(), 0);
+    BOOST_CHECK_EQUAL(MakeDateGmt(2000, 12, 31).GetSeconds(), 978220800);
+    BOOST_CHECK_EQUAL(MakeDateGmt(2017, 3, 20).GetSeconds(), 1489968000);
+}
+
+BOOST_AUTO_TEST_CASE(MakeTimestamp)
+{
+    using namespace common;
+
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(1970, 1, 1, 0, 0, 0, 0).GetMilliseconds(), 0);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2000, 12, 31, 23, 59, 59, 999999999).GetMilliseconds(), 978307199999);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2001, 9, 9, 1, 46, 39, 999999999).GetMilliseconds(), 999999999999);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2017, 3, 20, 18, 43, 19, 170038645).GetMilliseconds(), 1490035399170);
+
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(1970, 1, 1, 0, 0, 0, 0).GetSeconds(), 0);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2000, 12, 31, 23, 59, 59, 999999999).GetSeconds(), 978307199);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2001, 9, 9, 1, 46, 39, 999999999).GetSeconds(), 999999999);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2017, 3, 20, 18, 43, 19, 170038645).GetSeconds(), 1490035399);
+
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(1970, 1, 1, 0, 0, 0, 0).GetSecondFraction(), 0);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2000, 12, 31, 23, 59, 59, 999999999).GetSecondFraction(), 999999999);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2001, 9, 9, 1, 46, 39, 999999999).GetSecondFraction(), 999999999);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2017, 3, 20, 18, 43, 19, 170038645).GetSecondFraction(), 170038645);
+
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(1970, 1, 1, 0, 0, 0, 0).GetDate().GetMilliseconds(), 0);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2000, 12, 31, 23, 59, 59, 999999999).GetDate().GetMilliseconds(), 978307199999);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2001, 9, 9, 1, 46, 39, 999999999).GetDate().GetMilliseconds(), 999999999999);
+    BOOST_CHECK_EQUAL(MakeTimestampGmt(2017, 3, 20, 18, 43, 19, 170038645).GetDate().GetMilliseconds(), 1490035399170);
+}
+
+BOOST_AUTO_TEST_CASE(CastDateToTm)
+{
+    CheckDate(2024, 8, 5);
+    CheckDate(1987, 1, 1);
+    CheckDate(1999, 2, 18);
+    CheckDate(1997, 12, 9);
+    CheckDate(2007, 12, 31);
+    CheckDate(2001, 6, 21);
+}
+
+BOOST_AUTO_TEST_CASE(CastTimestampToTm)
+{
+    CheckTimestamp(1970, 1, 1, 0, 0, 0, 0);
+    CheckTimestamp(2000, 12, 31, 23, 59, 59, 999999999);
+    CheckTimestamp(2001, 9, 9, 1, 46, 39, 999999999);
+    CheckTimestamp(2017, 3, 20, 18, 43, 19, 170038645);
+    CheckTimestamp(2007, 12, 31, 19, 24, 44, 894375963);
+    CheckTimestamp(2001, 6, 21, 13, 53, 2, 25346547);
+}
+
+BOOST_AUTO_TEST_SUITE_END()


Mime
View raw message