1 // Copyright 2020 Peter Dimov
2 // Distributed under the Boost Software License, Version 1.0.
3 // https://www.boost.org/LICENSE_1_0.txt
4
5 #include <boost/core/lightweight_test.hpp>
6 #include <vector>
7
main()8 int main()
9 {
10 BOOST_TEST( BOOST_TEST( true ) );
11 BOOST_TEST_NOT( BOOST_TEST( false ) );
12
13 BOOST_TEST( BOOST_TEST_NOT( false ) );
14 BOOST_TEST_NOT( BOOST_TEST_NOT( true ) );
15
16 BOOST_TEST( BOOST_TEST_EQ( 1, 1 ) );
17 BOOST_TEST_NOT( BOOST_TEST_EQ( 1, 2 ) );
18
19 BOOST_TEST( BOOST_TEST_NE( 1, 2 ) );
20 BOOST_TEST_NOT( BOOST_TEST_NE( 1, 1 ) );
21
22 BOOST_TEST( BOOST_TEST_LT( 1, 2 ) );
23 BOOST_TEST_NOT( BOOST_TEST_LT( 1, 1 ) );
24
25 BOOST_TEST( BOOST_TEST_LE( 1, 1 ) );
26 BOOST_TEST_NOT( BOOST_TEST_LE( 2, 1 ) );
27
28 BOOST_TEST( BOOST_TEST_GT( 2, 1 ) );
29 BOOST_TEST_NOT( BOOST_TEST_GT( 1, 1 ) );
30
31 BOOST_TEST( BOOST_TEST_GE( 1, 1 ) );
32 BOOST_TEST_NOT( BOOST_TEST_GE( 1, 2 ) );
33
34 BOOST_TEST( BOOST_TEST_CSTR_EQ( "1", "1" ) );
35 BOOST_TEST_NOT( BOOST_TEST_CSTR_EQ( "1", "2" ) );
36
37 BOOST_TEST( BOOST_TEST_CSTR_NE( "1", "2" ) );
38 BOOST_TEST_NOT( BOOST_TEST_CSTR_NE( "1", "1" ) );
39
40 std::vector<int> v1;
41 v1.push_back( 1 );
42
43 std::vector<int> v2;
44
45 BOOST_TEST( BOOST_TEST_ALL_EQ(v1.begin(), v1.end(), v1.begin(), v1.end()) );
46 BOOST_TEST_NOT( BOOST_TEST_ALL_EQ(v1.begin(), v1.end(), v2.begin(), v2.end()) );
47
48 BOOST_TEST( BOOST_TEST_ALL_WITH(v1.begin(), v1.end(), v1.begin(), v1.end(), boost::detail::lw_test_eq()) );
49 BOOST_TEST_NOT( BOOST_TEST_ALL_WITH(v1.begin(), v1.end(), v2.begin(), v2.end(), boost::detail::lw_test_eq()) );
50
51 int const * p = 0;
52
53 BOOST_TEST( p == 0 ) || BOOST_TEST_EQ( *p, 0 );
54 BOOST_TEST( p != 0 ) && BOOST_TEST_EQ( *p, 0 );
55
56 int x = 0;
57 p = &x;
58
59 BOOST_TEST( p == 0 ) || BOOST_TEST_EQ( *p, 0 );
60 BOOST_TEST( p != 0 ) && BOOST_TEST_EQ( *p, 0 );
61
62 return boost::report_errors() == 14? 0: 1;
63 }
64