-
Notifications
You must be signed in to change notification settings - Fork 46
Add tests for fuzzing platform #1516
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
Conversation
Assertions.assertEquals(1, p1.generate(description, Unit).count()) | ||
Assertions.assertEquals(1, (p1.generate(description, Unit).first() as Seed.Simple).value) | ||
|
||
Assertions.assertEquals(1, p2.generate(description, Unit).count()) | ||
Assertions.assertEquals(2, (p2.generate(description, Unit).first() as Seed.Simple).value) | ||
|
||
Assertions.assertEquals(1, p3.generate(description, Unit).count()) | ||
Assertions.assertEquals(3, (p3.generate(description, Unit).first() as Seed.Simple).value) | ||
|
||
Assertions.assertEquals(1, p4.generate(description, Unit).count()) | ||
Assertions.assertEquals(4, (p4.generate(description, Unit).first() as Seed.Simple).value) | ||
|
||
Assertions.assertEquals(2, m1.generate(description, Unit).count()) | ||
Assertions.assertEquals(1, (m1.generate(description, Unit).first() as Seed.Simple).value) | ||
Assertions.assertEquals(2, (m1.generate(description, Unit).drop(1).first() as Seed.Simple).value) | ||
|
||
Assertions.assertEquals(2, m2.generate(description, Unit).count()) | ||
Assertions.assertEquals(3, (m2.generate(description, Unit).first() as Seed.Simple).value) | ||
Assertions.assertEquals(4, (m2.generate(description, Unit).drop(1).first() as Seed.Simple).value) | ||
|
||
Assertions.assertEquals(4, m3.generate(description, Unit).count()) | ||
Assertions.assertEquals(1, (m3.generate(description, Unit).first() as Seed.Simple).value) | ||
Assertions.assertEquals(2, (m3.generate(description, Unit).drop(1).first() as Seed.Simple).value) | ||
Assertions.assertEquals(3, (m3.generate(description, Unit).drop(2).first() as Seed.Simple).value) | ||
Assertions.assertEquals(4, (m3.generate(description, Unit).drop(3).first() as Seed.Simple).value) | ||
|
||
Assertions.assertEquals(4, m4.generate(description, Unit).count()) |
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.
Why not to import assertEquals
(here and in some other files)?
@Test | ||
fun `string generates same values`() { | ||
fun collect(): List<String> { | ||
return runBlockingWithContext { |
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.
Just thoughts: if we want reproducibility in many/most/all cases, maybe we should find a more general way to check it? E.g., introduce something like
fun <T> getReproducibleResults(generator: () -> T): T {
val probe1 = generator()
val probe2 = generator()
assertEquals(probe1, probe2)
return probe1
}
Then we can wrap calls to fuzzer in tests in such function and process results as usual. (Just an example, there are lots of other ways to check reproducibility more general).
Description
Fuzzing platform should generate reproducible tests on each run with new seeded random object and be cancelable by coroutine context. This PR fixes these problems and adds tests for core functions of fuzzing platform.
Type of Change
How Has This Been Tested?
Regression and integration tests
New tests have been added:
Manual Scenario
Tests now have to be reproducible. It means, that fuzzing with more time to run has all those tests that fuzzing with less time to run has. Try to run fuzzing on
org.utbot.fuzzing.samples.Strings#test(String s)
with different timeouts.Checklist: