@@ -20,6 +20,7 @@ function test_iterator(dict)
2020 @test isempty (setdiff (kk, keys (dict)))
2121 @test length (vv) == length (values (dict))
2222 @test isempty (setdiff (vv, values (dict)))
23+ @test dict == Dict (kk .=> vv)
2324end
2425
2526function basic_functionality (dict, k_values, v_values)
@@ -44,11 +45,25 @@ function basic_functionality(dict, k_values, v_values)
4445 @test values (dict) == [v_values[1 ]]
4546 @test keys (dict) == [k_values[1 ]]
4647 @test dict[k_values[1 ]] == v_values[1 ]
48+ @test get (dict, k_values[1 ], nothing ) == v_values[1 ]
49+ @test get (dict, k_values[1 ], v_values[2 ]) == v_values[1 ]
50+ for i in eachindex (k_values)
51+ if i != 1
52+ @test get (dict, k_values[i], nothing ) === nothing
53+ # Test that the implementation does not only work with `nothing`
54+ @test get (dict, k_values[i], v_values[i]) == v_values[i]
55+ end
56+ end
4757
4858 test_iterator (dict)
4959
5060 delete! (dict, k_values[1 ])
5161 @test ! haskey (dict, k_values[1 ])
62+ for i in eachindex (k_values)
63+ @test get (dict, k_values[i], nothing ) === nothing
64+ # Test that the implementation does not only work with `nothing`
65+ @test get (dict, k_values[i], v_values[i]) == v_values[i]
66+ end
5267 @test isempty (dict)
5368
5469 dict[k_values[1 ]] = v_values[1 ]
142157 dict[k] = v
143158 end
144159 dest = DoubleDicts. IndexDoubleDict ()
145- MOIU . _reverse_dict (dest, src)
160+ MOI . Utilities . _reverse_dict (dest, src)
146161 for (k, v) in src
147162 @test dest[v] == k
148163 end
161176 (MOI. SingleVariable (MOI. VariableIndex (1 )), MOI. ZeroOne ()),
162177 ]
163178 basic_functionality (dict, keys, vals)
164- end
179+ end
0 commit comments