Skip to content

Commit 09b2b97

Browse files
committed
[libc++] [test] Improve test coverage for containers' scary.pass.cpp
1 parent 4fde8c3 commit 09b2b97

File tree

5 files changed

+54
-28
lines changed

5 files changed

+54
-28
lines changed

libcxx/test/std/containers/associative/multimap/scary.pass.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@
88

99
// <map>
1010

11-
// class map class multimap
11+
// class map
12+
// class multimap
1213

13-
// Extension: SCARY/N2913 iterator compatibility between map and multimap
14+
// Extension: SCARY/N2913 iterator compatibility between map and multimap
1415

1516
#include <map>
1617

1718
#include "test_macros.h"
1819

19-
int main(int, char**) {
20+
void test() {
2021
typedef std::map<int, int> M1;
2122
typedef std::multimap<int, int> M2;
22-
M2::iterator i;
23-
M1::iterator j = i;
24-
((void)j);
2523

26-
return 0;
24+
ASSERT_SAME_TYPE(M1::iterator, M2::iterator);
25+
ASSERT_SAME_TYPE(M1::const_iterator, M2::const_iterator);
2726
}

libcxx/test/std/containers/associative/multiset/scary.pass.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@
88

99
// <set>
1010

11-
// class set class multiset
11+
// class set
12+
// class multiset
1213

13-
// Extension: SCARY/N2913 iterator compatibility between set and multiset
14+
// Extension: SCARY/N2913 iterator compatibility between set and multiset
1415

1516
#include <set>
1617

1718
#include "test_macros.h"
1819

19-
int main(int, char**) {
20+
void test() {
2021
typedef std::set<int> M1;
2122
typedef std::multiset<int> M2;
22-
M2::iterator i;
23-
M1::iterator j = i;
24-
((void)j);
2523

26-
return 0;
24+
ASSERT_SAME_TYPE(M1::iterator, M2::iterator);
25+
ASSERT_SAME_TYPE(M1::const_iterator, M2::const_iterator);
2726
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// <flat_map>
10+
11+
// class flat_map
12+
// class flat_multimap
13+
14+
// Extension: SCARY/N2913 iterator compatibility between flat_map and flat_multimap
15+
16+
#include <flat_map>
17+
18+
#include "test_macros.h"
19+
20+
void test() {
21+
typedef std::flat_map<int, int> M1;
22+
typedef std::flat_multimap<int, int> M2;
23+
24+
ASSERT_SAME_TYPE(M1::iterator, M2::iterator);
25+
ASSERT_SAME_TYPE(M1::const_iterator, M2::const_iterator);
26+
}

libcxx/test/std/containers/unord/unord.multimap/scary.pass.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@
88

99
// <unordered_map>
1010

11-
// class unordered_map class unordered_multimap
11+
// class unordered_map
12+
// class unordered_multimap
1213

13-
// Extension: SCARY/N2913 iterator compatibility between unordered_map and unordered_multimap
14+
// Extension: SCARY/N2913 iterator compatibility between unordered_map and unordered_multimap
1415

1516
#include <unordered_map>
1617

1718
#include "test_macros.h"
1819

19-
int main(int, char**) {
20+
void test() {
2021
typedef std::unordered_map<int, int> M1;
2122
typedef std::unordered_multimap<int, int> M2;
22-
M2::iterator i;
23-
M1::iterator j = i;
24-
((void)j);
2523

26-
return 0;
24+
ASSERT_SAME_TYPE(M1::iterator, M2::iterator);
25+
ASSERT_SAME_TYPE(M1::const_iterator, M2::const_iterator);
26+
ASSERT_SAME_TYPE(M1::local_iterator, M2::local_iterator);
27+
ASSERT_SAME_TYPE(M1::const_local_iterator, M2::const_local_iterator);
2728
}

libcxx/test/std/containers/unord/unord.multiset/scary.pass.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@
88

99
// <unordered_set>
1010

11-
// class unordered_set class unordered_multiset
11+
// class unordered_set
12+
// class unordered_multiset
1213

13-
// Extension: SCARY/N2913 iterator compatibility between unordered_set and unordered_multiset
14+
// Extension: SCARY/N2913 iterator compatibility between unordered_set and unordered_multiset
1415

1516
#include <unordered_set>
1617

1718
#include "test_macros.h"
1819

19-
int main(int, char**) {
20+
void test() {
2021
typedef std::unordered_set<int> M1;
2122
typedef std::unordered_multiset<int> M2;
22-
M2::iterator i;
23-
M1::iterator j = i;
24-
((void)j);
2523

26-
return 0;
24+
ASSERT_SAME_TYPE(M1::iterator, M2::iterator);
25+
ASSERT_SAME_TYPE(M1::const_iterator, M2::const_iterator);
26+
ASSERT_SAME_TYPE(M1::local_iterator, M2::local_iterator);
27+
ASSERT_SAME_TYPE(M1::const_local_iterator, M2::const_local_iterator);
2728
}

0 commit comments

Comments
 (0)