| 27 | #include <geode/tests/common.hpp> |
| 28 | |
| 29 | void test() |
| 30 | { |
| 31 | geode::OpenGeodeBasicLibrary::initialize(); |
| 32 | geode::Logger::set_level( geode::Logger::LEVEL::debug ); |
| 33 | geode::SmallSet< double > set; |
| 34 | geode::OpenGeodeBasicException::test( set.empty(), "Set should be empty" ); |
| 35 | geode::OpenGeodeBasicException::test( |
| 36 | set.insert( 0 ), "Insert should be done" ); |
| 37 | geode::OpenGeodeBasicException::test( |
| 38 | set.insert( 1 ), "Insert should be done" ); |
| 39 | geode::OpenGeodeBasicException::test( |
| 40 | !set.insert( 0 ), "Insert not allow" ); |
| 41 | geode::OpenGeodeBasicException::test( |
| 42 | !set.insert( 1 ), "Insert not allow" ); |
| 43 | geode::OpenGeodeBasicException::test( set.size(), "Set size should be 2" ); |
| 44 | set.erase( 0 ); |
| 45 | geode::OpenGeodeBasicException::test( set.size(), "Set size should be 1" ); |
| 46 | geode::OpenGeodeBasicException::test( |
| 47 | set.at( 0 ) == 1, "Wrong value in set" ); |
| 48 | geode::SmallSet< double > set2; |
| 49 | set2.insert( 0 ); |
| 50 | geode::OpenGeodeBasicException::test( |
| 51 | set2 != set, "Wrong first comparison of sets" ); |
| 52 | set2.insert( 2 ); |
| 53 | geode::OpenGeodeBasicException::test( |
| 54 | set2 != set, "Wrong second comparison of sets" ); |
| 55 | geode::SmallSet< double > set3; |
| 56 | set3.insert( 2 ); |
| 57 | set3.insert( 0 ); |
| 58 | geode::OpenGeodeBasicException::test( |
| 59 | set2 == set3, "Wrong third comparison of sets" ); |
| 60 | } |
| 61 | |
| 62 | OPENGEODE_TEST( "small-set" ) |