Project: engagement_generation License: BSD Dependencies:
Used by:
None |
engagement_generation/test/edu/wpi/hri/gen/policy/ref/DistractorSetTest.javaGo to the documentation of this file.00001 package edu.wpi.hri.gen.policy.ref; 00002 00003 import java.util.ArrayList; 00004 import java.util.List; 00005 00006 import junit.framework.TestCase; 00007 00008 import org.junit.Test; 00009 00010 import ros.pkg.bml_msgs.msg.Entity; 00011 00012 public class DistractorSetTest extends TestCase { 00013 00014 @Test 00015 public void testDistractorSet() { 00016 List<String> set = new ArrayList<String>(); 00017 set.add("one"); 00018 set.add("two"); 00019 set.add("three"); 00020 DistractorSet one = new DistractorSet(set); 00021 00022 assertEquals(3, one.size()); 00023 assertTrue(one.contains("one")); 00024 assertTrue(one.contains("two")); 00025 assertTrue(one.contains("three")); 00026 00027 Entity[] entSet = new Entity[2]; 00028 entSet[0] = new Entity(); 00029 entSet[0].id = "two"; 00030 entSet[1] = new Entity(); 00031 entSet[1].id = "four"; 00032 DistractorSet two = new DistractorSet(entSet); 00033 00034 assertEquals(2, two.size()); 00035 assertTrue(two.contains("two")); 00036 assertTrue(two.contains("four")); 00037 00038 DistractorSet intersect = one.intersection(two); 00039 assertEquals(1, intersect.size()); 00040 assertTrue(intersect.contains("two")); 00041 } 00042 00043 } |