Changeset 548 for trunk/quest-core-coverage-test/src
- Timestamp:
- 08/16/12 14:45:03 (12 years ago)
- Location:
- trunk/quest-core-coverage-test/src/test/java/de/ugoe/cs/quest/coverage
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-core-coverage-test/src/test/java/de/ugoe/cs/quest/coverage/CoverageCalculatorObservedTest.java
r518 r548 6 6 import de.ugoe.cs.quest.eventcore.Event; 7 7 import de.ugoe.cs.quest.usageprofiles.MockTrieBasedModel; 8 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 8 9 9 10 import java.util.LinkedHashSet; … … 26 27 public class CoverageCalculatorObservedTest { 27 28 28 Collection<List< ? extends Event<?>>> sequencesObserved;29 30 Set<List< ? extends Event<?>>> sequencesCovered;31 Set<List< ? extends Event<?>>> sequencesCovered2;32 Set<List< ? extends Event<?>>> sequencesNewPossible;29 Collection<List<Event>> sequencesObserved; 30 31 Set<List<Event>> sequencesCovered; 32 Set<List<Event>> sequencesCovered2; 33 Set<List<Event>> sequencesNewPossible; 33 34 34 35 MockTrieBasedModel mockProcess; … … 257 258 @Before 258 259 public void setUp() throws Exception { 259 sequencesObserved = new LinkedList<List< ? extends Event<?>>>();260 List<Event <?>> sequence1 = new ArrayList<Event<?>>();261 sequence1.add(new Event <String>("a"));262 sequence1.add(new Event <String>("b"));263 sequence1.add(new Event <String>("r"));264 sequence1.add(new Event <String>("a"));265 List<Event <?>> sequence2 = new ArrayList<Event<?>>();266 sequence2.add(new Event <String>("c"));267 sequence2.add(new Event <String>("a"));268 sequence2.add(new Event <String>("d"));269 sequence2.add(new Event <String>("a"));270 sequence2.add(new Event <String>("b"));271 sequence2.add(new Event <String>("r"));272 sequence2.add(new Event <String>("a"));260 sequencesObserved = new LinkedList<List<Event>>(); 261 List<Event> sequence1 = new ArrayList<Event>(); 262 sequence1.add(new Event(new StringEventType("a"))); 263 sequence1.add(new Event(new StringEventType("b"))); 264 sequence1.add(new Event(new StringEventType("r"))); 265 sequence1.add(new Event(new StringEventType("a"))); 266 List<Event> sequence2 = new ArrayList<Event>(); 267 sequence2.add(new Event(new StringEventType("c"))); 268 sequence2.add(new Event(new StringEventType("a"))); 269 sequence2.add(new Event(new StringEventType("d"))); 270 sequence2.add(new Event(new StringEventType("a"))); 271 sequence2.add(new Event(new StringEventType("b"))); 272 sequence2.add(new Event(new StringEventType("r"))); 273 sequence2.add(new Event(new StringEventType("a"))); 273 274 sequencesObserved.add(sequence1); 274 275 sequencesObserved.add(sequence2); 275 276 276 sequencesCovered = new LinkedHashSet<List< ? extends Event<?>>>();277 List<Event <?>> tmpList = new ArrayList<Event<?>>();278 tmpList.add(new Event <String>("a"));279 tmpList.add(new Event <String>("b"));280 tmpList.add(new Event <String>("r"));277 sequencesCovered = new LinkedHashSet<List<Event>>(); 278 List<Event> tmpList = new ArrayList<Event>(); 279 tmpList.add(new Event(new StringEventType("a"))); 280 tmpList.add(new Event(new StringEventType("b"))); 281 tmpList.add(new Event(new StringEventType("r"))); 281 282 sequencesCovered.add(tmpList); 282 tmpList = new ArrayList<Event <?>>();283 tmpList.add(new Event <String>("b"));284 tmpList.add(new Event <String>("r"));285 tmpList.add(new Event <String>("a"));286 tmpList.add(new Event <String>("e"));283 tmpList = new ArrayList<Event>(); 284 tmpList.add(new Event(new StringEventType("b"))); 285 tmpList.add(new Event(new StringEventType("r"))); 286 tmpList.add(new Event(new StringEventType("a"))); 287 tmpList.add(new Event(new StringEventType("e"))); 287 288 sequencesCovered.add(tmpList); 288 289 289 sequencesCovered2 = new LinkedHashSet<List< ? extends Event<?>>>();290 tmpList = new ArrayList<Event <?>>();291 tmpList.add(new Event <String>("a"));292 tmpList.add(new Event <String>("b"));293 tmpList.add(new Event <String>("r"));290 sequencesCovered2 = new LinkedHashSet<List<Event>>(); 291 tmpList = new ArrayList<Event>(); 292 tmpList.add(new Event(new StringEventType("a"))); 293 tmpList.add(new Event(new StringEventType("b"))); 294 tmpList.add(new Event(new StringEventType("r"))); 294 295 sequencesCovered2.add(tmpList); 295 296 296 sequencesNewPossible = new LinkedHashSet<List< ? extends Event<?>>>();297 tmpList = new ArrayList<Event <?>>();298 tmpList.add(new Event <String>("r"));299 tmpList.add(new Event <String>("a"));300 tmpList.add(new Event <String>("b"));297 sequencesNewPossible = new LinkedHashSet<List<Event>>(); 298 tmpList = new ArrayList<Event>(); 299 tmpList.add(new Event(new StringEventType("r"))); 300 tmpList.add(new Event(new StringEventType("a"))); 301 tmpList.add(new Event(new StringEventType("b"))); 301 302 sequencesNewPossible.add(tmpList); 302 303 -
trunk/quest-core-coverage-test/src/test/java/de/ugoe/cs/quest/coverage/CoverageCalculatorProcessTest.java
r518 r548 12 12 import de.ugoe.cs.quest.eventcore.Event; 13 13 import de.ugoe.cs.quest.usageprofiles.MockTrieBasedModel; 14 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 14 15 15 16 import org.junit.*; … … 26 27 public class CoverageCalculatorProcessTest { 27 28 28 Set<List< ? extends Event<?>>> sequencesCovered;29 Set<List< ? extends Event<?>>> sequencesCovered2;29 Set<List<Event>> sequencesCovered; 30 Set<List<Event>> sequencesCovered2; 30 31 MockTrieBasedModel mockProcess; 31 32 … … 189 190 @Before 190 191 public void setUp() throws Exception { 191 Collection<List< ? extends Event<?>>> sequences = new LinkedList<List<? extends Event<?>>>();192 List<Event <?>> sequence1 = new ArrayList<Event<?>>();193 sequence1.add(new Event <String>("a"));194 sequence1.add(new Event <String>("b"));195 sequence1.add(new Event <String>("r"));196 sequence1.add(new Event <String>("a"));197 List<Event <?>> sequence2 = new ArrayList<Event<?>>();198 sequence2.add(new Event <String>("c"));199 sequence2.add(new Event <String>("a"));200 sequence2.add(new Event <String>("d"));201 sequence2.add(new Event <String>("a"));202 sequence2.add(new Event <String>("b"));203 sequence2.add(new Event <String>("r"));204 sequence2.add(new Event <String>("a"));192 Collection<List<Event>> sequences = new LinkedList<List<Event>>(); 193 List<Event> sequence1 = new ArrayList<Event>(); 194 sequence1.add(new Event(new StringEventType("a"))); 195 sequence1.add(new Event(new StringEventType("b"))); 196 sequence1.add(new Event(new StringEventType("r"))); 197 sequence1.add(new Event(new StringEventType("a"))); 198 List<Event> sequence2 = new ArrayList<Event>(); 199 sequence2.add(new Event(new StringEventType("c"))); 200 sequence2.add(new Event(new StringEventType("a"))); 201 sequence2.add(new Event(new StringEventType("d"))); 202 sequence2.add(new Event(new StringEventType("a"))); 203 sequence2.add(new Event(new StringEventType("b"))); 204 sequence2.add(new Event(new StringEventType("r"))); 205 sequence2.add(new Event(new StringEventType("a"))); 205 206 sequences.add(sequence1); 206 207 sequences.add(sequence2); 207 208 208 sequencesCovered = new LinkedHashSet<List< ? extends Event<?>>>();209 List<Event <?>> tmpList = new ArrayList<Event<?>>();210 tmpList.add(new Event <String>("a"));211 tmpList.add(new Event <String>("b"));212 tmpList.add(new Event <String>("r"));209 sequencesCovered = new LinkedHashSet<List<Event>>(); 210 List<Event> tmpList = new ArrayList<Event>(); 211 tmpList.add(new Event(new StringEventType("a"))); 212 tmpList.add(new Event(new StringEventType("b"))); 213 tmpList.add(new Event(new StringEventType("r"))); 213 214 sequencesCovered.add(tmpList); 214 tmpList = new ArrayList<Event <?>>();215 tmpList.add(new Event <String>("b"));216 tmpList.add(new Event <String>("r"));217 tmpList.add(new Event <String>("a"));215 tmpList = new ArrayList<Event>(); 216 tmpList.add(new Event(new StringEventType("b"))); 217 tmpList.add(new Event(new StringEventType("r"))); 218 tmpList.add(new Event(new StringEventType("a"))); 218 219 sequencesCovered.add(tmpList); 219 220 220 sequencesCovered2 = new LinkedHashSet<List< ? extends Event<?>>>();221 tmpList = new ArrayList<Event <?>>();222 tmpList.add(new Event <String>("a"));223 tmpList.add(new Event <String>("b"));224 tmpList.add(new Event <String>("r"));221 sequencesCovered2 = new LinkedHashSet<List<Event>>(); 222 tmpList = new ArrayList<Event>(); 223 tmpList.add(new Event(new StringEventType("a"))); 224 tmpList.add(new Event(new StringEventType("b"))); 225 tmpList.add(new Event(new StringEventType("r"))); 225 226 sequencesCovered2.add(tmpList); 226 227 -
trunk/quest-core-coverage-test/src/test/java/de/ugoe/cs/quest/coverage/SequenceToolsTest.java
r518 r548 15 15 import de.ugoe.cs.quest.usageprofiles.IStochasticProcess; 16 16 import de.ugoe.cs.quest.usageprofiles.MockTrieBasedModel; 17 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 17 18 18 19 import org.junit.*; … … 28 29 public class SequenceToolsTest { 29 30 30 Collection<List< ? extends Event<?>>> sequences;31 Set<List< ? extends Event<?>>> subSequences;31 Collection<List<Event>> sequences; 32 Set<List<Event>> subSequences; 32 33 MockTrieBasedModel mockProcess; 33 34 … … 37 38 int length = 2; 38 39 39 Set<List< ? extends Event<?>>> result = SequenceTools.containedSubSequences(sequences, length);40 Set<List<Event>> result = SequenceTools.containedSubSequences(sequences, length); 40 41 41 42 assertNotNull(result); … … 49 50 int length = 2; 50 51 51 Set<List< ? extends Event<?>>> result = SequenceTools.containedSubSequences(null, length);52 Set<List<Event>> result = SequenceTools.containedSubSequences(null, length); 52 53 assertNotNull(result); 53 54 assertTrue(result.isEmpty()); … … 73 74 public void testGenerateWeights_1() 74 75 throws Exception { 75 Map<List< ? extends Event<?>>, Double> result = SequenceTools.generateWeights(mockProcess, subSequences);76 77 assertNotNull(result); 78 Set<Entry<List< ? extends Event<?>>, Double>> entrySet = result.entrySet();76 Map<List<Event>, Double> result = SequenceTools.generateWeights(mockProcess, subSequences); 77 78 assertNotNull(result); 79 Set<Entry<List<Event>, Double>> entrySet = result.entrySet(); 79 80 assertEquals(subSequences.size(),entrySet.size()); 80 for( Entry<List< ? extends Event<?>>, Double> entry : entrySet ) {81 for( Entry<List<Event>, Double> entry : entrySet ) { 81 82 assertEquals(Double.valueOf(2.0d), entry.getValue()); 82 83 assertTrue(subSequences.contains(entry.getKey())); … … 87 88 public void testGenerateWeights_2() 88 89 throws Exception { 89 Map<List< ? extends Event<?>>, Double> result = SequenceTools.generateWeights(null, subSequences);90 91 Set<Entry<List< ? extends Event<?>>, Double>> entrySet = result.entrySet();90 Map<List<Event>, Double> result = SequenceTools.generateWeights(null, subSequences); 91 92 Set<Entry<List<Event>, Double>> entrySet = result.entrySet(); 92 93 assertEquals(subSequences.size(),entrySet.size()); 93 for( Entry<List< ? extends Event<?>>, Double> entry : entrySet ) {94 for( Entry<List<Event>, Double> entry : entrySet ) { 94 95 assertEquals(Double.valueOf(0.0d), entry.getValue()); 95 96 assertTrue(subSequences.contains(entry.getKey())); … … 100 101 public void testGenerateWeights_3() 101 102 throws Exception { 102 Map<List< ? extends Event<?>>, Double> result = SequenceTools.generateWeights(mockProcess, null);103 Map<List<Event>, Double> result = SequenceTools.generateWeights(mockProcess, null); 103 104 104 105 assertNotNull(result); … … 148 149 public void setUp() 149 150 throws Exception { 150 sequences = new LinkedList<List< ? extends Event<?>>>();151 List<Event <?>> sequence1 = new ArrayList<Event<?>>();152 sequence1.add(new Event <String>("a"));153 sequence1.add(new Event <String>("b"));154 sequence1.add(new Event <String>("r"));155 sequence1.add(new Event <String>("a"));156 List<Event <?>> sequence2 = new ArrayList<Event<?>>();157 sequence2.add(new Event <String>("c"));158 sequence2.add(new Event <String>("a"));159 sequence2.add(new Event <String>("d"));160 sequence2.add(new Event <String>("a"));161 sequence2.add(new Event <String>("b"));162 sequence2.add(new Event <String>("r"));163 sequence2.add(new Event <String>("a"));151 sequences = new LinkedList<List<Event>>(); 152 List<Event> sequence1 = new ArrayList<Event>(); 153 sequence1.add(new Event(new StringEventType("a"))); 154 sequence1.add(new Event(new StringEventType("b"))); 155 sequence1.add(new Event(new StringEventType("r"))); 156 sequence1.add(new Event(new StringEventType("a"))); 157 List<Event> sequence2 = new ArrayList<Event>(); 158 sequence2.add(new Event(new StringEventType("c"))); 159 sequence2.add(new Event(new StringEventType("a"))); 160 sequence2.add(new Event(new StringEventType("d"))); 161 sequence2.add(new Event(new StringEventType("a"))); 162 sequence2.add(new Event(new StringEventType("b"))); 163 sequence2.add(new Event(new StringEventType("r"))); 164 sequence2.add(new Event(new StringEventType("a"))); 164 165 sequences.add(sequence1); 165 166 sequences.add(sequence2); 166 167 167 subSequences = new LinkedHashSet<List< ? extends Event<?>>>();168 List<Event <?>> tmpList = new ArrayList<Event<?>>();169 tmpList.add(new Event <String>("a"));170 tmpList.add(new Event <String>("b"));171 subSequences.add(tmpList); 172 tmpList = new ArrayList<Event <?>>();173 tmpList.add(new Event <String>("b"));174 tmpList.add(new Event <String>("r"));175 subSequences.add(tmpList); 176 tmpList = new ArrayList<Event <?>>();177 tmpList.add(new Event <String>("r"));178 tmpList.add(new Event <String>("a"));179 subSequences.add(tmpList); 180 tmpList = new ArrayList<Event <?>>();181 tmpList.add(new Event <String>("c"));182 tmpList.add(new Event <String>("a"));183 subSequences.add(tmpList); 184 tmpList = new ArrayList<Event <?>>();185 tmpList.add(new Event <String>("a"));186 tmpList.add(new Event <String>("d"));187 subSequences.add(tmpList); 188 tmpList = new ArrayList<Event <?>>();189 tmpList.add(new Event <String>("d"));190 tmpList.add(new Event <String>("a"));168 subSequences = new LinkedHashSet<List<Event>>(); 169 List<Event> tmpList = new ArrayList<Event>(); 170 tmpList.add(new Event(new StringEventType("a"))); 171 tmpList.add(new Event(new StringEventType("b"))); 172 subSequences.add(tmpList); 173 tmpList = new ArrayList<Event>(); 174 tmpList.add(new Event(new StringEventType("b"))); 175 tmpList.add(new Event(new StringEventType("r"))); 176 subSequences.add(tmpList); 177 tmpList = new ArrayList<Event>(); 178 tmpList.add(new Event(new StringEventType("r"))); 179 tmpList.add(new Event(new StringEventType("a"))); 180 subSequences.add(tmpList); 181 tmpList = new ArrayList<Event>(); 182 tmpList.add(new Event(new StringEventType("c"))); 183 tmpList.add(new Event(new StringEventType("a"))); 184 subSequences.add(tmpList); 185 tmpList = new ArrayList<Event>(); 186 tmpList.add(new Event(new StringEventType("a"))); 187 tmpList.add(new Event(new StringEventType("d"))); 188 subSequences.add(tmpList); 189 tmpList = new ArrayList<Event>(); 190 tmpList.add(new Event(new StringEventType("d"))); 191 tmpList.add(new Event(new StringEventType("a"))); 191 192 subSequences.add(tmpList); 192 193
Note: See TracChangeset
for help on using the changeset viewer.