susumu.yata
null+****@clear*****
Tue Dec 16 10:44:21 JST 2014
susumu.yata 2014-11-19 13:14:43 +0900 (Wed, 19 Nov 2014) New Revision: 8e30ea1d812f8d4cb23db2ddbb55463e45c71588 https://github.com/groonga/grnxx/commit/8e30ea1d812f8d4cb23db2ddbb55463e45c71588 Message: Update tests for Int. Modified files: test/test_data_types.cpp Modified: test/test_data_types.cpp (+24 -4) =================================================================== --- test/test_data_types.cpp 2014-11-19 13:10:39 +0900 (0774a30) +++ test/test_data_types.cpp 2014-11-19 13:14:43 +0900 (4d1f8a8) @@ -156,14 +156,14 @@ void test_int() { assert((+grnxx::Int(0)).value() == 0); assert((+grnxx::Int(1)).value() == 1); - assert((+grnxx::Int::min()).value() == grnxx::Int::min_value()); - assert((+grnxx::Int::max()).value() == grnxx::Int::max_value()); + assert((+grnxx::Int::min()).is_min()); + assert((+grnxx::Int::max()).is_max()); assert((+grnxx::Int::na()).is_na()); assert((-grnxx::Int(0)).value() == 0); assert((-grnxx::Int(1)).value() == -1); - assert((-grnxx::Int::min()).value() == grnxx::Int::max_value()); - assert((-grnxx::Int::max()).value() == grnxx::Int::min_value()); + assert((-grnxx::Int::min()).is_max()); + assert((-grnxx::Int::max()).is_min()); assert((-grnxx::Int::na()).is_na()); assert((~grnxx::Int(0)).value() == -1); @@ -470,6 +470,26 @@ void test_int() { assert((grnxx::Int::na() >= grnxx::Int(0)).is_na()); assert((grnxx::Int::na() >= grnxx::Int(1)).is_na()); assert((grnxx::Int::na() >= grnxx::Int::na()).is_na()); + + assert(grnxx::Int(0).match(grnxx::Int(0))); + assert(!grnxx::Int(0).match(grnxx::Int(1))); + assert(!grnxx::Int(0).match(grnxx::Int::na())); + assert(!grnxx::Int(1).match(grnxx::Int(0))); + assert(grnxx::Int(1).match(grnxx::Int(1))); + assert(!grnxx::Int(1).match(grnxx::Int::na())); + assert(!grnxx::Int::na().match(grnxx::Int(0))); + assert(!grnxx::Int::na().match(grnxx::Int(1))); + assert(grnxx::Int::na().match(grnxx::Int::na())); + + assert(!grnxx::Int(0).unmatch(grnxx::Int(0))); + assert(grnxx::Int(0).unmatch(grnxx::Int(1))); + assert(grnxx::Int(0).unmatch(grnxx::Int::na())); + assert(grnxx::Int(1).unmatch(grnxx::Int(0))); + assert(!grnxx::Int(1).unmatch(grnxx::Int(1))); + assert(grnxx::Int(1).unmatch(grnxx::Int::na())); + assert(grnxx::Int::na().unmatch(grnxx::Int(0))); + assert(grnxx::Int::na().unmatch(grnxx::Int(1))); + assert(!grnxx::Int::na().unmatch(grnxx::Int::na())); } void test_float() { -------------- next part -------------- HTML����������������������������... 下载