@@ -132,6 +132,39 @@ StdMapTestSuite.test("UnorderedMap.init(grouping:by:)") {
132132 expectEqual ( m [ 3 ] ? . size ( ) , 6 )
133133}
134134
135+ StdMapTestSuite . test ( " Dictionary<CInt, CInt>.init(_: Map) " ) {
136+ let cxxMap0 = Map ( )
137+ let swiftMap0 = Dictionary < CInt , CInt > ( cxxMap0)
138+ expectTrue ( swiftMap0. isEmpty)
139+
140+ let cxxMap1 = initMap ( )
141+ let swiftMap1 = Dictionary < CInt , CInt > ( cxxMap1)
142+ expectEqual ( swiftMap1, [ 1 : 3 , 2 : 2 , 3 : 3 ] )
143+ }
144+
145+ StdMapTestSuite . test ( " Dictionary<CInt, CInt>.init(_: UnorderedMap) " ) {
146+ let cxxMap0 = UnorderedMap ( )
147+ let swiftMap0 = Dictionary < CInt , CInt > ( cxxMap0)
148+ expectTrue ( swiftMap0. isEmpty)
149+
150+ let cxxMap1 = initUnorderedMap ( )
151+ let swiftMap1 = Dictionary < CInt , CInt > ( cxxMap1)
152+ expectEqual ( swiftMap1, [ 1 : 3 , 2 : 2 , 3 : 3 ] )
153+ }
154+
155+ StdMapTestSuite . test ( " Dictionary<std.string, std.string>.init(_: MapStrings) " ) {
156+ let cxxMap0 = MapStrings ( )
157+ let swiftMap0 = Dictionary < std . string , std . string > ( cxxMap0)
158+ expectTrue ( swiftMap0. isEmpty)
159+
160+ var cxxMap1 = MapStrings ( )
161+ cxxMap1 [ std. string ( " abc " ) ] = std. string ( " def " )
162+ cxxMap1 [ std. string ( " 890 " ) ] = std. string ( " 3210 " )
163+ let swiftMap1 = Dictionary < std . string , std . string > ( cxxMap1)
164+ expectEqual ( swiftMap1, [ std. string ( " abc " ) : std. string ( " def " ) ,
165+ std. string ( " 890 " ) : std. string ( " 3210 " ) ] )
166+ }
167+
135168StdMapTestSuite . test ( " Map.subscript " ) {
136169 // This relies on the `std::map` conformance to `CxxDictionary` protocol.
137170 var m = initMap ( )
0 commit comments