Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
huixie90 committed Oct 13, 2024
1 parent 9d322c2 commit 5dbd96d
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), false);
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s), true);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s+1), false);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s + 1), false);
#endif
test(s, s, true);
test(s, s+1, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), false);
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s), true);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s+1), true);
test(cpp20_random_access_iterator<const char*>(s+1), cpp20_random_access_iterator<const char*>(s), false);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s + 1), true);
test(cpp20_random_access_iterator<const char*>(s + 1), cpp20_random_access_iterator<const char*>(s), false);
#endif
test(s, s, true);
test(s, s+1, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), false);
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s), false);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s+1), true);
test(cpp20_random_access_iterator<const char*>(s+1), cpp20_random_access_iterator<const char*>(s), false);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s + 1), true);
test(cpp20_random_access_iterator<const char*>(s + 1), cpp20_random_access_iterator<const char*>(s), false);
#endif
test(s, s, false);
test(s, s+1, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), true);
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s), true);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s+1), false);
test(cpp20_random_access_iterator<const char*>(s+1), cpp20_random_access_iterator<const char*>(s), true);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s + 1), false);
test(cpp20_random_access_iterator<const char*>(s + 1), cpp20_random_access_iterator<const char*>(s), true);
#endif
test(s, s, true);
test(s, s+1, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), true);
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s), false);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s+1), false);
test(cpp20_random_access_iterator<const char*>(s+1), cpp20_random_access_iterator<const char*>(s), true);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s + 1), false);
test(cpp20_random_access_iterator<const char*>(s + 1), cpp20_random_access_iterator<const char*>(s), true);
#endif
test(s, s, false);
test(s, s+1, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), true);
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s), false);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s+1), true);
test(cpp20_random_access_iterator<const char*>(s), cpp20_random_access_iterator<const char*>(s + 1), true);
#endif
test(s, s, false);
test(s, s+1, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@

template <class Iter>
TEST_CONSTEXPR_CXX17 void test() {
int i = 0;
Iter iter(&i);
std::reverse_iterator<Iter> const reverse(iter);
typename std::reverse_iterator<Iter>::iterator_type base = reverse.base();
assert(base == Iter(&i));
int i = 0;
Iter iter(&i);
std::reverse_iterator<Iter> const reverse(iter);
typename std::reverse_iterator<Iter>::iterator_type base = reverse.base();
assert(base == Iter(&i));
}

TEST_CONSTEXPR_CXX17 bool tests() {
test<bidirectional_iterator<int*> >();
test<random_access_iterator<int*> >();
test<bidirectional_iterator<int*> >();
test<random_access_iterator<int*> >();
#if TEST_STD_VER >= 20
test<cpp20_random_access_iterator<int*>>();
test<cpp20_random_access_iterator<int*>>();
#endif
return true;
return true;
}

int main(int, char**) {
tests();
tests();
#if TEST_STD_VER > 14
static_assert(tests(), "");
static_assert(tests(), "");
#endif
return 0;
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class cpp20_bidirectional_iterator_with_arrow {

public:
using iterator_category = std::input_iterator_tag;
using iterator_concept = std::bidirectional_iterator_tag;
using iterator_concept = std::bidirectional_iterator_tag;
using value_type = std::iterator_traits<It>::value_type;
using difference_type = std::iterator_traits<It>::difference_type;

Expand Down Expand Up @@ -68,7 +68,7 @@ class cpp20_bidirectional_iterator_with_arrow {
return x.it_ != y.it_;
}

friend It base(const cpp20_bidirectional_iterator_with_arrow& i) { return i.it_; }
friend It base(const cpp20_bidirectional_iterator_with_arrow& i) { return i.it_; }
};
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(random_access_iterator<const char*>(s+5), 4, '1');
test(random_access_iterator<const char*>(s+5), 0, '5');
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s+5), 4, '1');
test(cpp20_random_access_iterator<const char*>(s+5), 0, '5');
test(cpp20_random_access_iterator<const char*>(s + 5), 4, '1');
test(cpp20_random_access_iterator<const char*>(s + 5), 0, '5');
#endif
test(s+5, 4, '1');
test(s+5, 0, '5');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ int main(int, char**)
{
A a;
test(&a+1, A());
test(random_access_iterator<A*>(&a+1), A());
test(random_access_iterator<A*>(&a + 1), A());
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<A*>(&a+1), A());
test(cpp20_random_access_iterator<A*>(&a + 1), A());
#endif

#if TEST_STD_VER > 14
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST_CONSTEXPR_CXX17 bool tests() {
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s+5), 5, cpp20_random_access_iterator<const char*>(s+10));
test(cpp20_random_access_iterator<const char*>(s + 5), 5, cpp20_random_access_iterator<const char*>(s + 10));
#endif
test(s+5, 5, s+10);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ TEST_CONSTEXPR_CXX17 void test(It i, typename std::iterator_traits<It>::differen

TEST_CONSTEXPR_CXX17 bool tests() {
char const* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
test(random_access_iterator<const char*>(s + 5), 5, random_access_iterator<const char*>(s));
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s+5), 5, cpp20_random_access_iterator<const char*>(s));
test(cpp20_random_access_iterator<const char*>(s + 5), 5, cpp20_random_access_iterator<const char*>(s));
#endif
test(s+5, 5, s);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ TEST_CONSTEXPR_CXX17 void test(It i, typename std::iterator_traits<It>::differen

TEST_CONSTEXPR_CXX17 bool tests() {
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
test(random_access_iterator<const char*>(s + 5), 5, random_access_iterator<const char*>(s + 10));
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s+5), 5, cpp20_random_access_iterator<const char*>(s+10));
test(cpp20_random_access_iterator<const char*>(s + 5), 5, cpp20_random_access_iterator<const char*>(s + 10));
#endif
test(s+5, 5, s+10);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ TEST_CONSTEXPR_CXX17 void test(It i, typename std::iterator_traits<It>::differen

TEST_CONSTEXPR_CXX17 bool tests() {
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
test(random_access_iterator<const char*>(s + 5), 5, random_access_iterator<const char*>(s));
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s+5), 5, cpp20_random_access_iterator<const char*>(s));
test(cpp20_random_access_iterator<const char*>(s + 5), 5, cpp20_random_access_iterator<const char*>(s));
#endif
test(s+5, 5, s);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s+2));
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s+2));
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s+1), cpp20_random_access_iterator<const char*>(s+2));
test(cpp20_random_access_iterator<const char*>(s + 1), cpp20_random_access_iterator<const char*>(s + 2));
#endif
test(s+1, s+2);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s));
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s));
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s+1), cpp20_random_access_iterator<const char*>(s));
test(cpp20_random_access_iterator<const char*>(s + 1), cpp20_random_access_iterator<const char*>(s));
#endif
test(s+1, s);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s+2));
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s+2));
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s+1), cpp20_random_access_iterator<const char*>(s+2));
test(cpp20_random_access_iterator<const char*>(s + 1), cpp20_random_access_iterator<const char*>(s + 2));
#endif
test(s+1, s+2);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST_CONSTEXPR_CXX17 bool tests() {
test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s));
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s));
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s+1), cpp20_random_access_iterator<const char*>(s));
test(cpp20_random_access_iterator<const char*>(s + 1), cpp20_random_access_iterator<const char*>(s));
#endif
test(s+1, s);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,33 @@

template <class It>
TEST_CONSTEXPR_CXX17 void test_one(It i) {
const std::reverse_iterator<It> r = std::make_reverse_iterator(i);
assert(r.base() == i);
const std::reverse_iterator<It> r = std::make_reverse_iterator(i);
assert(r.base() == i);
}

template <class It>
TEST_CONSTEXPR_CXX17 void test() {
const char* s = "1234567890";
It b(s);
It e(s+10);
while (b != e)
test_one (b++);
const char* s = "1234567890";
It b(s);
It e(s + 10);
while (b != e)
test_one(b++);
}

TEST_CONSTEXPR_CXX17 bool tests() {
test<const char*>();
test<bidirectional_iterator<const char*>>();
test<random_access_iterator<const char*>>();
test<const char*>();
test<bidirectional_iterator<const char*>>();
test<random_access_iterator<const char*>>();
#if TEST_STD_VER >= 20
test<cpp20_random_access_iterator<const char*>>();
test<cpp20_random_access_iterator<const char*>>();
#endif
return true;
return true;
}

int main(int, char**) {
tests();
tests();
#if TEST_STD_VER > 14
static_assert(tests(), "");
static_assert(tests(), "");
#endif
return 0;
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ TEST_CONSTEXPR_CXX17 void test_one(It1 l, It2 r, std::ptrdiff_t x) {
template <class Iter>
TEST_CONSTEXPR_CXX17 void test() {
// Test same base iterator type
using PC = const char*;
char s[3] = {0};

test_one(Iter(s), Iter(s), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TEST_CONSTEXPR_CXX17 bool tests() {
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
#if TEST_STD_VER >= 20
test(cpp20_random_access_iterator<const char*>(s+5), 5, cpp20_random_access_iterator<const char*>(s));
test(cpp20_random_access_iterator<const char*>(s + 5), 5, cpp20_random_access_iterator<const char*>(s));
#endif
test(s+5, 5, s);
return true;
Expand Down

0 comments on commit 5dbd96d

Please sign in to comment.