You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SqlScriptRunner.execCommand(connection, "CREATE TABLE users(id bigint generated by default as identity primary key, name varchar(255), age int, points int);\n")
33
+
SqlScriptRunner.execCommand(connection, "CREATE TABLE users(id bigint generated by default as identity primary key, name varchar(255), age int, points boolean, flag bit, created_at timestamp not null);\n")
31
34
schemaDto =DbInfoExtractor.extract(connection)
32
35
solver =SMTLibZ3DbConstraintSolver()
33
36
solver.initializeExecutor()
@@ -50,32 +53,44 @@ class SMTLibZ3DbConstraintSolverTest {
50
53
@Test
51
54
funselectFromUsers() {
52
55
53
-
val newActions = solver.solve(schemaDto, "SELECT * FROM Users;", 2)
56
+
val newActions = solver.solve(schemaDto, "SELECT * FROM Users WHERE name = 'agus';", 2)
54
57
55
58
assertEquals(2, newActions.size)
56
59
57
60
val genesInsert1:List<Gene> = newActions[0].seeTopGenes()
58
61
59
-
assertEquals(4, genesInsert1.size)
62
+
assertEquals(6, genesInsert1.size)
60
63
61
64
for (gene in genesInsert1) {
62
65
when (gene.name) {
63
66
"ID"-> {
64
67
assertTrue(gene isSqlPrimaryKeyGene)
65
68
val child = gene.getViewOfChildren().first()
66
-
assertEquals(0, (child asIntegerGene).value)
69
+
assertEquals(4, (child asIntegerGene).value)
67
70
}
68
71
"NAME"-> {
69
72
assertTrue(gene isStringGene)
70
-
assertEquals("", (gene asStringGene).value)
73
+
assertEquals("agus", (gene asStringGene).value)
71
74
}
72
75
"AGE"-> {
73
76
assertTrue(gene isIntegerGene)
74
-
assertEquals(0, (gene asIntegerGene).value)
77
+
assertEquals(5, (gene asIntegerGene).value)
75
78
}
76
79
"POINTS"-> {
77
-
assertTrue(gene isIntegerGene)
78
-
assertEquals(0, (gene asIntegerGene).value)
80
+
assertTrue(gene isBooleanGene)
81
+
assertEquals(true, (gene asBooleanGene).value)
82
+
}
83
+
"FLAG"-> {
84
+
// H2 maps BIT to BOOLEAN, so the solver produces a BooleanGene
85
+
assertTrue(gene isBooleanGene)
86
+
assertEquals(true, (gene asBooleanGene).value)
87
+
}
88
+
"CREATED_AT"-> {
89
+
// TIMESTAMP epoch-seconds from Z3 are converted to a formatted datetime string
90
+
assertTrue(gene isImmutableDataHolderGene)
91
+
val value = (gene asImmutableDataHolderGene).value
0 commit comments