MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test

Function test

tests/basic/test-range.cpp:29–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#include <geode/tests/common.hpp>
28
29void test()
30{
31 std::vector< geode::index_t > range1;
32 for( const auto i : geode::Range{ 10 } )
33 {
34 range1.push_back( i );
35 }
36 geode::OpenGeodeBasicException::test(
37 range1.front() == 0, "Wrong Range first item (1)" );
38 geode::OpenGeodeBasicException::test(
39 range1.back() == 9, "Wrong Range last item (1)" );
40
41 std::vector< geode::index_t > range2;
42 for( const auto i : geode::Range{ 3, 10 } )
43 {
44 range2.push_back( i );
45 }
46 geode::OpenGeodeBasicException::test(
47 range2.front() == 3, "Wrong Range first item (2)" );
48 geode::OpenGeodeBasicException::test(
49 range2.back() == 9, "Wrong Range last item (2)" );
50
51 std::vector< geode::index_t > reverse_range1;
52 for( const auto i : geode::ReverseRange{ 10 } )
53 {
54 reverse_range1.push_back( i );
55 }
56 geode::OpenGeodeBasicException::test(
57 reverse_range1.front() == 9, "Wrong ReverseRange first item (1)" );
58 geode::OpenGeodeBasicException::test(
59 reverse_range1.back() == 0, "Wrong ReverseRange last item (2)" );
60
61 std::vector< geode::index_t > reverse_range2;
62 for( const auto i : geode::ReverseRange{ 10, 3 } )
63 {
64 reverse_range2.push_back( i );
65 }
66 geode::OpenGeodeBasicException::test(
67 reverse_range2.front() == 9, "Wrong ReverseRange first item (1)" );
68 geode::OpenGeodeBasicException::test(
69 reverse_range2.back() == 3, "Wrong ReverseRange last item (2)" );
70
71 struct Foo
72 {
73 Foo() = delete;
74 Foo( double d, int i ) : double_( d ), int_( i )
75 {
76 geode::Logger::info( "Foo(d,i)" );
77 }
78 Foo( const Foo& foo ) = delete;
79 Foo( Foo&& foo ) = default;
80 ~Foo()
81 {
82 geode::Logger::info( "~Foo" );
83 }
84 double double_{ 0 };
85 int int_{ 0 };
86 };

Callers

nothing calls this directly

Calls 3

infoFunction · 0.85
emptyMethod · 0.80
reserveMethod · 0.45

Tested by

no test coverage detected