-
Notifications
You must be signed in to change notification settings - Fork 273
Select concrete class for abstract types #1100
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
Merged
thk123
merged 10 commits into
diffblue:test-gen-support
from
thk123:feature/select-concrete-class-for-abstract-types
Jul 11, 2017
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8dcff58
Code tidy changes
a904f08
Add class for randomly selecting a concrete child of an abstract class
d5513db
Make class derived from object factory
78a4e05
Made the random selection alphabetical instead of random
2c79f51
Removed extra code and just combined into gen_nondet_pointer_init
e4ac6e2
Modified definition of abstract to not fall over on void* types
90286a8
Adding regression tests showing the modified gen code works
248ec8e
Don't require pointers point to classes
a3f7eed
Made jsonArrays test less strict
e2e670e
Removing whitespace that causes an error on windows
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+712 Bytes
regression/cbmc-java/instance-method-user-interface-field/TestClass.class
Binary file not shown.
44 changes: 44 additions & 0 deletions
44
regression/cbmc-java/instance-method-user-interface-field/TestClass.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
interface I | ||
{ | ||
int getANumber(); | ||
} | ||
|
||
class A implements I { | ||
public int a; | ||
|
||
public int getANumber() { return a; } | ||
} | ||
|
||
class B implements I { | ||
public int b; | ||
public int getANumber() { return b; } | ||
} | ||
|
||
class TestClass | ||
{ | ||
public I someObject; | ||
|
||
public boolean foo() { | ||
if(someObject!=null) | ||
{ | ||
int result = someObject.getANumber(); | ||
if(result == 42) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public static void main(String[] args) | ||
{ | ||
// ensure that A, B are referenced explicitly | ||
// in order to get them converted into GOTO | ||
A a = new A(); | ||
B b = new B(); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
regression/cbmc-java/instance-method-user-interface-field/test.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CORE | ||
TestClass.class | ||
--cover location --function TestClass.foo --show-goto-functions | ||
\.someObject = \(struct I \*\)\w+ | ||
@class_identifier = "java::A"; |
Binary file added
BIN
+347 Bytes
regression/cbmc-java/instance-method-user-interface-two-fields-different/A.class
Binary file not shown.
Binary file added
BIN
+347 Bytes
regression/cbmc-java/instance-method-user-interface-two-fields-different/B.class
Binary file not shown.
Binary file added
BIN
+351 Bytes
regression/cbmc-java/instance-method-user-interface-two-fields-different/C.class
Binary file not shown.
Binary file added
BIN
+351 Bytes
regression/cbmc-java/instance-method-user-interface-two-fields-different/D.class
Binary file not shown.
Binary file added
BIN
+118 Bytes
regression/cbmc-java/instance-method-user-interface-two-fields-different/I.class
Binary file not shown.
Binary file added
BIN
+118 Bytes
regression/cbmc-java/instance-method-user-interface-two-fields-different/J.class
Binary file not shown.
Binary file added
BIN
+836 Bytes
regression/cbmc-java/instance-method-user-interface-two-fields-different/TestClass.class
Binary file not shown.
61 changes: 61 additions & 0 deletions
61
regression/cbmc-java/instance-method-user-interface-two-fields-different/TestClass.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
interface I | ||
{ | ||
int getANumber(); | ||
} | ||
|
||
class A implements I { | ||
public int a; | ||
|
||
public int getANumber() { return a; } | ||
} | ||
|
||
class B implements I { | ||
public int b; | ||
public int getANumber() { return b; } | ||
} | ||
|
||
interface J | ||
{ | ||
int getANumber(); | ||
} | ||
|
||
class C implements J { | ||
public int c; | ||
public int getANumber() { return c; } | ||
} | ||
|
||
class D implements J { | ||
public int d; | ||
public int getANumber() { return d; } | ||
} | ||
|
||
class TestClass | ||
{ | ||
public I someObject1; | ||
public J someObject2; | ||
|
||
public boolean foo() { | ||
if(someObject1 != null && someObject2 != null) | ||
{ | ||
if(someObject1.getANumber() == someObject2.getANumber()) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public static void main(String[] args) | ||
{ | ||
// ensure that A, B, C, D are referenced explicitly | ||
// in order to get them converted into GOTO | ||
A a = new A(); | ||
B b = new B(); | ||
C c = new C(); | ||
D d = new D(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
regression/cbmc-java/instance-method-user-interface-two-fields-different/test.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CORE | ||
TestClass.class | ||
--cover location --function TestClass.foo --show-goto-functions | ||
@class_identifier = "java::A"; | ||
@class_identifier = "java::C"; | ||
.someObject1 = \(struct I \*\) | ||
.someObject2 = \(struct J \*\) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+691 Bytes
regression/cbmc-java/static-method-user-interface-param/TestClass.class
Binary file not shown.
42 changes: 42 additions & 0 deletions
42
regression/cbmc-java/static-method-user-interface-param/TestClass.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
interface I | ||
{ | ||
int getANumber(); | ||
} | ||
|
||
class A implements I { | ||
public int a; | ||
|
||
public int getANumber() { return a; } | ||
} | ||
|
||
class B implements I { | ||
public int b; | ||
public int getANumber() { return b; } | ||
} | ||
|
||
class TestClass | ||
{ | ||
public static boolean foo(I someObject) { | ||
if(someObject!=null) | ||
{ | ||
int result = someObject.getANumber(); | ||
if(result == 42) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public static void main(String[] args) | ||
{ | ||
// ensure that A, B are referenced explicitly | ||
// in order to get them converted into GOTO | ||
A a = new A(); | ||
B b = new B(); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
regression/cbmc-java/static-method-user-interface-param/test.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CORE | ||
TestClass.class | ||
--cover location --function TestClass.foo --show-goto-functions | ||
@class_identifier = "java::A"; | ||
= \(struct I \*\) | ||
tmp_object_factory\$\d+ = null; |
Binary file added
BIN
+347 Bytes
regression/cbmc-java/static-method-user-interface-two-params-different/A.class
Binary file not shown.
Binary file added
BIN
+347 Bytes
regression/cbmc-java/static-method-user-interface-two-params-different/B.class
Binary file not shown.
Binary file added
BIN
+351 Bytes
regression/cbmc-java/static-method-user-interface-two-params-different/C.class
Binary file not shown.
Binary file added
BIN
+351 Bytes
regression/cbmc-java/static-method-user-interface-two-params-different/D.class
Binary file not shown.
Binary file added
BIN
+118 Bytes
regression/cbmc-java/static-method-user-interface-two-params-different/I.class
Binary file not shown.
Binary file added
BIN
+118 Bytes
regression/cbmc-java/static-method-user-interface-two-params-different/J.class
Binary file not shown.
Binary file added
BIN
+804 Bytes
regression/cbmc-java/static-method-user-interface-two-params-different/TestClass.class
Binary file not shown.
57 changes: 57 additions & 0 deletions
57
regression/cbmc-java/static-method-user-interface-two-params-different/TestClass.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
interface I | ||
{ | ||
int getANumber(); | ||
} | ||
|
||
class A implements I { | ||
public int a; | ||
public int getANumber() { return a; } | ||
} | ||
|
||
class B implements I { | ||
public int b; | ||
public int getANumber() { return b; } | ||
} | ||
|
||
interface J | ||
{ | ||
int getANumber(); | ||
} | ||
|
||
class C implements J { | ||
public int c; | ||
public int getANumber() { return c; } | ||
} | ||
|
||
class D implements J { | ||
public int d; | ||
public int getANumber() { return d; } | ||
} | ||
|
||
class TestClass | ||
{ | ||
public static boolean foo(I someObject1, J someObject2) { | ||
if(someObject1 != null && someObject2 != null) | ||
{ | ||
if(someObject1.getANumber() == someObject2.getANumber()) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public static void main(String[] args) | ||
{ | ||
// ensure that A, B, C, D are referenced explicitly | ||
// in order to get them converted into GOTO | ||
A a = new A(); | ||
B b = new B(); | ||
C c = new C(); | ||
D d = new D(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
regression/cbmc-java/static-method-user-interface-two-params-different/test.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
TestClass.class | ||
--cover location --function TestClass.foo --show-goto-functions | ||
@class_identifier = "java::A"; | ||
= \(struct I \*\) | ||
@class_identifier = "java::C"; | ||
= \(struct J \*\) | ||
tmp_object_factory\$\d+ = null; | ||
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. Missing new line 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. Fixed |
Binary file added
BIN
+347 Bytes
regression/cbmc-java/static-method-user-interface-two-params-same/A.class
Binary file not shown.
Binary file added
BIN
+347 Bytes
regression/cbmc-java/static-method-user-interface-two-params-same/B.class
Binary file not shown.
Binary file added
BIN
+118 Bytes
regression/cbmc-java/static-method-user-interface-two-params-same/I.class
Binary file not shown.
Binary file added
BIN
+697 Bytes
regression/cbmc-java/static-method-user-interface-two-params-same/TestClass.class
Binary file not shown.
41 changes: 41 additions & 0 deletions
41
regression/cbmc-java/static-method-user-interface-two-params-same/TestClass.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
interface I | ||
{ | ||
int getANumber(); | ||
} | ||
|
||
class A implements I { | ||
public int a; | ||
|
||
public int getANumber() { return a; } | ||
} | ||
|
||
class B implements I { | ||
public int b; | ||
public int getANumber() { return b; } | ||
} | ||
|
||
class TestClass | ||
{ | ||
public static boolean foo(I someObject1, I someObject2) { | ||
if(someObject1 != null && someObject2 != null) | ||
{ | ||
if(someObject1.getANumber() == someObject2.getANumber()) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public static void main(String[] args) | ||
{ | ||
// ensure that A, B are referenced explicitly | ||
// in order to get them converted into GOTO | ||
A a = new A(); | ||
B b = new B(); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
regression/cbmc-java/static-method-user-interface-two-params-same/test.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CORE | ||
TestClass.class | ||
--cover location --function TestClass.foo --show-goto-functions | ||
@class_identifier = "java::A"; | ||
= \(struct I \*\) | ||
tmp_object_factory\$\d+ = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
main function is not needed (in other tests, too)
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.
ok, understood, could you change the comment into something along the line