File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,8 @@ module StdMap {
12
12
header "std-map.h"
13
13
requires cplusplus
14
14
}
15
+
16
+ module StdSet {
17
+ header "std-set.h"
18
+ requires cplusplus
19
+ }
Original file line number Diff line number Diff line change
1
+ #ifndef TEST_INTEROP_CXX_STDLIB_INPUTS_STD_SET_H
2
+ #define TEST_INTEROP_CXX_STDLIB_INPUTS_STD_SET_H
3
+
4
+ #include < set>
5
+
6
+ using SetOfCInt = std::set<int >;
7
+
8
+ inline SetOfCInt initSetOfCInt () { return {1 , 5 , 3 }; }
9
+
10
+ #endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_SET_H
Original file line number Diff line number Diff line change
1
+ // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none)
2
+ //
3
+ // REQUIRES: executable_test
4
+ //
5
+ // Enable this everywhere once we have a solution for modularizing other C++ stdlibs: rdar://87654514
6
+ // REQUIRES: OS=macosx || OS=linux-gnu
7
+
8
+ import StdlibUnittest
9
+ import StdSet
10
+ import CxxStdlib
11
+ import Cxx
12
+
13
+ var StdSetTestSuite = TestSuite ( " StdSet " )
14
+
15
+ extension SetOfCInt . const_iterator : UnsafeCxxInputIterator { }
16
+ extension SetOfCInt : CxxSequence { }
17
+
18
+ StdSetTestSuite . test ( " iterate " ) {
19
+ let s = initSetOfCInt ( )
20
+ var result = [ CInt] ( )
21
+ for x in s {
22
+ result. append ( x)
23
+ }
24
+ expectEqual ( result [ 0 ] , 1 )
25
+ expectEqual ( result [ 1 ] , 3 )
26
+ expectEqual ( result [ 2 ] , 5 )
27
+ }
28
+
29
+ runAllTests ( )
You can’t perform that action at this time.
0 commit comments