-
Notifications
You must be signed in to change notification settings - Fork 397
Support CODDTest for SQLite #1181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
17952a4
2f0c1ee
b8dbd9d
d9579b8
9a3a2e9
9ead27a
089d2d0
8e607cc
5eff148
d45cd02
0fd99d3
c00a19b
dcdf7d6
597b43a
294eb73
b2d0284
f523530
a9f7dce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package sqlancer.common.oracle; | ||
|
|
||
| import sqlancer.Main.StateLogger; | ||
| import sqlancer.MainOptions; | ||
| import sqlancer.SQLConnection; | ||
| import sqlancer.SQLGlobalState; | ||
| import sqlancer.common.query.ExpectedErrors; | ||
|
|
||
| public abstract class CODDTestBase<S extends SQLGlobalState<?, ?>> implements TestOracle<S> { | ||
| protected final S state; | ||
| protected final ExpectedErrors errors = new ExpectedErrors(); | ||
| protected final StateLogger logger; | ||
| protected final MainOptions options; | ||
| protected final SQLConnection con; | ||
| protected String auxiliaryQueryString; | ||
| protected String foldedQueryString; | ||
| protected String originalQueryString; | ||
|
|
||
| public CODDTestBase(S state) { | ||
| this.state = state; | ||
| this.con = state.getConnection(); | ||
| this.logger = state.getLogger(); | ||
| this.options = state.getOptions(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,4 +34,27 @@ public String columnNamesAsString(Function<C, String> function) { | |
| return getColumns().stream().map(function).collect(Collectors.joining(", ")); | ||
| } | ||
|
|
||
| public void addTable(T table) { | ||
| if (!this.tables.contains(table)) { | ||
| this.tables.add(table); | ||
| columns.addAll(table.getColumns()); | ||
| } | ||
| } | ||
|
|
||
| public void removeTable(T table) { | ||
| if (this.tables.contains(table)) { | ||
| this.tables.remove(table); | ||
| for (C c : table.getColumns()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it actually necessary to remove the columns?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's necessary for CODDTest. I introduced the |
||
| columns.remove(c); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public boolean isContained(T table) { | ||
| return this.tables.contains(table); | ||
| } | ||
|
|
||
| public int getSize() { | ||
| return this.tables.size(); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we would also add test cases later on for these new methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I add the unit tests for these new methods and an unit tests for SQLite3 CODDTest oracle.