[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-schemafuzz] branch master updated: Passing Weight co
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-schemafuzz] branch master updated: Passing Weight consnsistency and mutation picking based on weight tests |
Date: |
Wed, 23 May 2018 17:43:20 +0200 |
This is an automated email from the git hooks/post-receive script.
erwan-ulrich pushed a commit to branch master
in repository schemafuzz.
The following commit(s) were added to refs/heads/master by this push:
new 7eb5f4f Passing Weight consnsistency and mutation picking based on
weight tests
7eb5f4f is described below
commit 7eb5f4f2a1fceab5deaea73b8aa48463c2072bd2
Author: Feideus <address@hidden>
AuthorDate: Wed May 23 17:43:13 2018 +0200
Passing Weight consnsistency and mutation picking based on weight tests
---
TODO.txt | 7 +++
.../java/org/schemaspy/model/GenericTreeNode.java | 14 ++++-
.../org/schemaspy/model/GenericTreeNodeTest.java | 72 ++++++++++++++++++++++
.../default-testCompile/createdFiles.lst | 1 +
.../testCompile/default-testCompile/inputFiles.lst | 1 +
5 files changed, 94 insertions(+), 1 deletion(-)
diff --git a/TODO.txt b/TODO.txt
new file mode 100644
index 0000000..9f602f1
--- /dev/null
+++ b/TODO.txt
@@ -0,0 +1,7 @@
+TODO BETTER SCORING ON THE LEVEL OF CRASH/CODE COVERAGE
+MANUAL FOR USE
+WEBSITE
+TEST CASES/ UNIT TESTING INTEGRATION TESTING
+VARCHAR CLASSIFIER (LATER)
+
+
diff --git a/src/main/java/org/schemaspy/model/GenericTreeNode.java
b/src/main/java/org/schemaspy/model/GenericTreeNode.java
index fea85b8..d8442c5 100644
--- a/src/main/java/org/schemaspy/model/GenericTreeNode.java
+++ b/src/main/java/org/schemaspy/model/GenericTreeNode.java
@@ -46,6 +46,7 @@ public class GenericTreeNode {
this.weight = 1;
this.id = id;
initDepth();
+ initDepth();
this.initial_state_row = initial_state_row;
this.potential_changes = discoverMutationPossibilities(rootMutation);
}
@@ -54,6 +55,15 @@ public class GenericTreeNode {
return id;
}
+ public void setSubTreeWeight(int subTreeWeight)
+ {
+ this.subTreeWeight = subTreeWeight;
+ }
+
+ public void setPotential_changes(ArrayList<SingleChange> potCh) //used in
tests
+ {
+ this.potential_changes = potCh;
+ }
public Integer getWeight() {
return this.weight;
@@ -184,7 +194,9 @@ public class GenericTreeNode {
public ArrayList<SingleChange>
discoverMutationPossibilities(GenericTreeNode rootMutation) {
- int i;
+ if(initial_state_row == null)
+ return null ;
+
ArrayList<SingleChange> possibilities = new ArrayList<SingleChange>();
//TRYING TO DISCOVER RAW POSSIBILITIES
diff --git a/src/test/java/org/schemaspy/model/GenericTreeNodeTest.java
b/src/test/java/org/schemaspy/model/GenericTreeNodeTest.java
new file mode 100644
index 0000000..a1d8576
--- /dev/null
+++ b/src/test/java/org/schemaspy/model/GenericTreeNodeTest.java
@@ -0,0 +1,72 @@
+package org.schemaspy.model;
+
+import nl.jqno.equalsverifier.internal.exceptions.AssertionException;
+import org.junit.*;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+public class GenericTreeNodeTest {
+
+
+
+ @Test
+ public void WeightPropagationTest() throws AssertionException
+ {
+ Random rand = new Random();
+
+ GenericTreeNode gtn1 = new GenericTreeNode(null,1,null,null);
+ gtn1.setWeight(rand.nextInt(Integer.MAX_VALUE));
+ GenericTreeNode gtn2 = new GenericTreeNode(null,2,null,gtn1);
+ gtn2.setWeight(rand.nextInt(Integer.MAX_VALUE));
+ GenericTreeNode gtn3 = new GenericTreeNode(null,3,null,gtn1);
+ gtn3.setWeight(Integer.MAX_VALUE);
+
+ gtn1.addChild(gtn2);
+ gtn1.addChild(gtn3);
+
+ gtn2.propagateWeight();
+ gtn3.propagateWeight();
+
+ Assert.assertEquals("Testing Weight propagation
",gtn1.getSubTreeWeight(),gtn2.getWeight()+gtn3.getWeight());
+
+ gtn2.setWeight(10);
+ gtn3.setWeight(10);
+
+ gtn2.propagateWeight();
+ gtn3.propagateWeight();
+
+ gtn1.setSubTreeWeight(0);
+
+ Assert.assertFalse(gtn1.getSubTreeWeight() ==
gtn2.getWeight()+gtn3.getWeight());
+
+ }
+
+ @Test
+ public void SingleChangeBasedOnWeightShouldNotReturnNull() throws
AssertionException
+ {
+ GenericTreeNode gtn1 = new GenericTreeNode(null,1,null,null);
+ gtn1.setPotential_changes(new ArrayList<>());
+
+ GenericTreeNode gtn2= new GenericTreeNode(null,2,null,gtn1);
+ gtn2.setPotential_changes(new ArrayList<>());
+ gtn2.setWeight(10);
+
+ GenericTreeNode gtn3 = new GenericTreeNode(null,3,null,gtn1);
+ gtn3.setPotential_changes(new ArrayList<>());
+ gtn3.setWeight(10);
+
+ SingleChange sg1 = new SingleChange(null,null,"1","2");
+ SingleChange sg2 = new SingleChange(null,null,"1","3");
+ SingleChange sg3 = new SingleChange(null,null,"hello","hella");
+ SingleChange sg4 = new SingleChange(null,null,"f","t");
+
+ gtn1.getPotential_changes().add(sg1);
+ gtn2.getPotential_changes().add(sg2);
+ gtn3.getPotential_changes().add(sg3);
+ gtn3.getPotential_changes().add(sg4);
+
+ Assert.assertNotNull(gtn1.singleChangeBasedOnWeight());
+ }
+
+}
diff --git
a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
index 192a47c..49bfcc2 100644
---
a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
+++
b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
@@ -47,6 +47,7 @@ org/schemaspy/integrationtesting/SchemaMetaIT.class
org/schemaspy/service/TableServiceTest.class
org/schemaspy/util/InflectionTest.class
org/schemaspy/integrationtesting/H2SpacesIT.class
+org/schemaspy/model/GenericTreeNodeTest.class
org/schemaspy/DbAnalyzerTest.class
org/schemaspy/testcontainer/MSSQLServerIT.class
org/schemaspy/testing/LoggingRule.class
diff --git
a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
index 54e1935..ed8091a 100644
---
a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
+++
b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
@@ -17,6 +17,7 @@
/home/feideus/Work/BFHWork/schemafuzz/src/test/java/org/schemaspy/db/config/PropertiesFinderTest.java
/home/feideus/Work/BFHWork/schemafuzz/src/test/java/org/dummy/DummyDriverUnsatisfiedCtor.java
/home/feideus/Work/BFHWork/schemafuzz/src/test/java/org/schemaspy/ConfigTest.java
+/home/feideus/Work/BFHWork/schemafuzz/src/test/java/org/schemaspy/model/GenericTreeNodeTest.java
/home/feideus/Work/BFHWork/schemafuzz/src/test/java/org/schemaspy/service/DatabaseServiceIT.java
/home/feideus/Work/BFHWork/schemafuzz/src/test/java/org/schemaspy/db/config/PropertiesResolverTest.java
/home/feideus/Work/BFHWork/schemafuzz/src/test/java/org/schemaspy/testing/H2MemoryRule.java
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-schemafuzz] branch master updated: Passing Weight consnsistency and mutation picking based on weight tests,
gnunet <=