• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionfff263087db82b051dc912381d89d5ce8b374995 (tree)
Time2019-02-26 10:32:07
AuthorTatsuhiro Tsuchiya <t-tutiya@ist....>
CommiterTatsuhiro Tsuchiya

Log Message

add permuteRandomTest

Change Summary

Incremental Difference

--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
1+/bin/
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<projectDescription>
3+ <name>randomCIT</name>
4+ <comment></comment>
5+ <projects>
6+ </projects>
7+ <buildSpec>
8+ <buildCommand>
9+ <name>org.eclipse.jdt.core.javabuilder</name>
10+ <arguments>
11+ </arguments>
12+ </buildCommand>
13+ </buildSpec>
14+ <natures>
15+ <nature>org.eclipse.jdt.core.javanature</nature>
16+ </natures>
17+</projectDescription>
--- /dev/null
+++ b/input/seke2014.txt
@@ -0,0 +1,11 @@
1+# SEKE 2014
2+
3+# ˆöŽq‚Ɛ…€
4+OS (Windows7 Windows8 Linux)
5+Browser (IE Firefox)
6+Protocol (IPv4 IPv6)
7+DBMS (MySQL Sybase Oracle)
8+
9+# §–ñ
10+#1
11+(if (== [OS] Linux) (<> [Browser] IE))
--- a/src/randomCIT/Generator.java
+++ b/src/randomCIT/Generator.java
@@ -26,7 +26,7 @@ class GeneratorFactory {
2626 randomseed);
2727 }
2828 else {
29- return new pureRandomTest(parametermodel, groupList, constrainthandler,
29+ return new permuteRandomTest(parametermodel, groupList, constrainthandler,
3030 randomseed);
3131 }
3232 } catch (Exception e) {
--- /dev/null
+++ b/src/randomCIT/permuteRandomTest.java
@@ -0,0 +1,71 @@
1+package randomCIT;
2+
3+import java.util.ArrayList;
4+import java.util.Collections;
5+import java.util.Comparator;
6+import java.util.List;
7+
8+public class permuteRandomTest extends Generator {
9+
10+ protected int numOfRows;
11+
12+ permuteRandomTest(ParameterModel parametermodel, GList groupList,
13+ ConstraintHandler constrainthandler, long randomseed) {
14+ super(parametermodel, groupList, constrainthandler, null, randomseed);
15+ }
16+
17+ @Override
18+ List<Testcase> generate() throws OutOfMaxNumOfTestcasesException {
19+
20+ List<Testcase> res = new ArrayList<Testcase>();
21+
22+ for (int row = 0; row < genran.numOfTestCases; row++) {
23+ Testcase test = createRow(parametermodel.size);
24+ res.add(test);
25+ if (res.size() > MaxNumOfTestcases)
26+ throw new OutOfMaxNumOfTestcasesException();
27+ }
28+
29+ return res;
30+ }
31+
32+ // sampling with factors permuted
33+ private Testcase createRow(int numOfFactors) {
34+ Testcase t = new Testcase(numOfFactors);
35+ t.initiallize();
36+
37+ // create a random sequence with no repetition
38+ ArrayList<intTuple> factorSequence = new ArrayList<intTuple>();
39+ for (int factor = 0; factor < numOfFactors; factor++) {
40+ factorSequence.add(new intTuple(rnd.nextInt(Integer.MAX_VALUE), factor));
41+ }
42+ Collections.sort(factorSequence, new Comparator<intTuple>() {
43+ @Override
44+ public int compare(intTuple lhs, intTuple rhs) {
45+ // 1 - less than, -1 - greater than, 0 - equal
46+ return lhs.val > rhs.val ? 1 : (lhs.val < rhs.val) ? -1 : 0;
47+ }
48+ });
49+
50+ for (intTuple it: factorSequence) {
51+ int levelsOfCurrentFactor = parametermodel.range[it.index];
52+ while (true) {
53+ int value = rnd.nextInt(levelsOfCurrentFactor);
54+ t.set(it.index, value);
55+ if (constrainthandler.isPossible(t) == true) {
56+ break;
57+ }
58+ }
59+ }
60+ return t;
61+ }
62+
63+ class intTuple {
64+ int val;
65+ int index;
66+ intTuple (int val, int index) {
67+ this.val = val; this.index = index;
68+ }
69+ }
70+}
71+