-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more test projects and fix more bugs
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
- Loading branch information
1 parent
a818190
commit ff7f8a7
Showing
7 changed files
with
293 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
26 changes: 26 additions & 0 deletions
26
src/test/data/source-code/jvm/test-project-4/crosspackage/Fuzzer.java
This file contains 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,26 @@ | ||
// Copyright 2025 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
package crosspackage; | ||
|
||
import com.code_intelligence.jazzer.api.FuzzedDataProvider; | ||
import crosspackage.helper.HelperClass; | ||
|
||
public class Fuzzer { | ||
public static void fuzzerTestOneInput(FuzzedDataProvider data) { | ||
HelperClass helper = new HelperClass(); | ||
helper.helperMethod(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/test/data/source-code/jvm/test-project-4/crosspackage/helper/HelperClass.java
This file contains 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,27 @@ | ||
// Copyright 2025 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
package crosspackage.helper; | ||
|
||
public class HelperClass { | ||
public void helperMethod() { | ||
System.out.println("Helper Method Called from Another Package"); | ||
} | ||
|
||
public void unreachableHelperMethod() { | ||
System.out.println("Unreachable Helper Method"); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/test/data/source-code/jvm/test-project-5/complex/Fuzzer.java
This file contains 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,43 @@ | ||
package complex; | ||
|
||
import com.code_intelligence.jazzer.api.FuzzedDataProvider; | ||
|
||
class A { | ||
B b = new B(); | ||
|
||
void callB() { | ||
b.callC(); | ||
} | ||
|
||
void unreachableAMethod() { | ||
System.out.println("Unreachable Method in A"); | ||
} | ||
} | ||
|
||
class B { | ||
C c = new C(); | ||
|
||
void callC() { | ||
c.finalMethod(); | ||
} | ||
|
||
void unreachableBMethod() { | ||
System.out.println("Unreachable Method in B"); | ||
} | ||
} | ||
|
||
class C { | ||
void finalMethod() { | ||
System.out.println("Final Method in Chain Called"); | ||
} | ||
|
||
void unreachableCMethod() { | ||
System.out.println("Unreachable Method in C"); | ||
} | ||
} | ||
|
||
public class Fuzzer { | ||
public static void fuzzerTestOneInput(FuzzedDataProvider data) { | ||
A a = new A(); | ||
a.callB(); | ||
} |
61 changes: 61 additions & 0 deletions
61
src/test/data/source-code/jvm/test-project-6/inheritance/Fuzzer.java
This file contains 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 @@ | ||
// Copyright 2025 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
package inheritance; | ||
|
||
import com.code_intelligence.jazzer.api.FuzzedDataProvider; | ||
|
||
class SuperClass { | ||
void superMethod() { | ||
System.out.println("SuperClass Method Called"); | ||
recursiveHelper(2); | ||
} | ||
|
||
void recursiveHelper(int n) { | ||
if (n > 0) { | ||
System.out.println("Superclass Recursion: " + n); | ||
recursiveHelper(n - 1); | ||
} | ||
} | ||
|
||
void unreachableSuperMethod() { | ||
System.out.println("Unreachable Method in SuperClass"); | ||
} | ||
} | ||
|
||
class SubClass extends SuperClass { | ||
@Override | ||
void superMethod() { | ||
System.out.println("SubClass Method Overriding SuperClass"); | ||
super.superMethod(); | ||
} | ||
|
||
void unreachableSubMethod() { | ||
System.out.println("Unreachable Method in SubClass"); | ||
} | ||
} | ||
|
||
public class Fuzzer { | ||
public static void fuzzerTestOneInput(FuzzedDataProvider data) { | ||
SuperClass obj; | ||
if ("subclass".equals(data.consumeString(10))) { | ||
obj = new SubClass(); | ||
} else { | ||
obj = new SuperClass(); | ||
} | ||
obj.superMethod(); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/test/data/source-code/jvm/test-project-7/combined/Fuzzer.java
This file contains 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,49 @@ | ||
package combined; | ||
|
||
import com.code_intelligence.jazzer.api.FuzzedDataProvider; | ||
import combined.helper.HelperClass; | ||
|
||
abstract class AbstractBase { | ||
abstract void abstractMethod(); | ||
|
||
void unreachableAbstractBaseMethod() { | ||
System.out.println("Unreachable Method in AbstractBase"); | ||
} | ||
} | ||
|
||
class ConcreteClass extends AbstractBase { | ||
@Override | ||
void abstractMethod() { | ||
System.out.println("ConcreteClass Implementation of Abstract Method"); | ||
} | ||
|
||
void chainMethod() { | ||
System.out.println("Chain Method Called"); | ||
NestedClass.InnerClass ic = new NestedClass.InnerClass(); | ||
ic.innerMethod(); | ||
} | ||
|
||
void unreachableConcreteMethod() { | ||
System.out.println("Unreachable Method in ConcreteClass"); | ||
} | ||
} | ||
|
||
class NestedClass { | ||
static class InnerClass { | ||
void innerMethod() { | ||
System.out.println("Inner Class Method in Combined Project"); | ||
} | ||
|
||
void unreachableInnerClassMethod() { | ||
System.out.println("Unreachable Method in InnerClass"); | ||
} | ||
} | ||
} | ||
|
||
public class Fuzzer { | ||
public static void fuzzerTestOneInput(FuzzedDataProvider data) { | ||
AbstractBase base = new ConcreteClass(); | ||
((ConcreteClass) base).chainMethod(); | ||
base.abstractMethod(); | ||
} | ||
} |
Oops, something went wrong.