added a first test for sets

This commit is contained in:
Renaud Pawlak 2017-07-24 17:17:33 +02:00
parent a52ea53162
commit 75022df498
2 changed files with 36 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import source.nativestructures.ObjectMaps;
import source.nativestructures.OverloadWithNative;
import source.nativestructures.Properties;
import source.nativestructures.Reflect;
import source.nativestructures.Sets;
import source.nativestructures.Strings;
import source.nativestructures.WeakReferences;
@ -38,6 +39,13 @@ public class NativeStructuresTests extends AbstractTest {
}, getSourceFile(Collections.class));
}
@Test
public void testSets() {
eval((logHandler, result) -> {
logHandler.assertNoProblems();
}, getSourceFile(Sets.class));
}
@Test
public void testStringBuilder() {
eval((logHandler, result) -> {
@ -74,7 +82,8 @@ public class NativeStructuresTests extends AbstractTest {
public void testMaps() {
eval((logHandler, result) -> {
Assert.assertEquals("There should be no errors", 0, logHandler.reportedProblems.size());
assertEquals("1,a,2,b,2,a,true,[1, 2],[a, b],1,true,size2=2,1,2,[],empty=true,-null-,1,a,2,b", result.get("trace"));
assertEquals("1,a,2,b,2,a,true,[1, 2],[a, b],1,true,size2=2,1,2,[],empty=true,-null-,1,a,2,b",
result.get("trace"));
}, getSourceFile(Maps.class));
}

View File

@ -0,0 +1,26 @@
package source.nativestructures;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class Sets {
public static void main(String[] args) {
Map<Set, String> map = new HashMap<>();
Set s = new HashSet();
s.add("1");
s.add("2");
Set s2 = new HashSet();
s2.add("2");
s2.add("1");
map.put(s, "hi");
map.put(s2, "bye");
System.out.println(map.get(s));
// TODO: make this work (see #196)
// assert "bye".equals(map.get(s));
}
}