File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ module StdIteratorTraits {
2
+ header "std-iterator_traits.h"
3
+ requires cplusplus
4
+ }
5
+
1
6
module StdVector {
2
7
header "std-vector.h"
3
8
requires cplusplus
Original file line number Diff line number Diff line change
1
+ #ifndef TEST_INTEROP_CXX_STDLIB_INPUTS_STD_ITERATORTRAITS_H
2
+ #define TEST_INTEROP_CXX_STDLIB_INPUTS_STD_ITERATORTRAITS_H
3
+
4
+ #include < iterator>
5
+
6
+ using IteratorTraits = std::iterator_traits<int >;
7
+
8
+ inline IteratorTraits initIterator () { return {}; }
9
+
10
+ #endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_ITERATOR_H
Original file line number Diff line number Diff line change
1
+ // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-cxx-interop)
2
+ //
3
+ // REQUIRES: executable_test
4
+ //
5
+ // Enable this everywhere once we have a solution for modularizing libstdc++: rdar://87654514
6
+ // REQUIRES: OS=macosx
7
+
8
+ import StdlibUnittest
9
+ import StdIteratorTraits
10
+ import std. iterator_traits
11
+
12
+ var StdIteratorTraitsTestSuite = TestSuite ( " StdIteratorTraits " )
13
+
14
+ extension IteratorTraits : RandomAccessIteractor {
15
+ public var inputIt : Int { 0 }
16
+ public var numberToAdvance : Int { 1 }
17
+ }
18
+
19
+ StdIteratorTraitsTestSuite . test ( " init " ) {
20
+ let a = [ 12 , 13 , 14 ]
21
+ let iterator = IteratorTraits ( )
22
+ iterator. inputIt = a [ 0 ]
23
+ iterator. numberToAdvance = 1
24
+ expectEqual ( iterator, 13 )
25
+ }
26
+
27
+ runAllTests ( )
You can’t perform that action at this time.
0 commit comments