-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for outcome encoding roundtrips, encode in base64 for now
- Loading branch information
Showing
2 changed files
with
63 additions
and
21 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
modules/framework/cats/test/src-js-native/TestOutcomeEncodingTests.scala
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,40 @@ | ||
package weaver | ||
package framework | ||
package test | ||
|
||
object TestOutcomeEncodingTests | ||
extends FunSuite { | ||
|
||
private val anOutcome = | ||
TestOutcomeNative("suite-1", "test-1", 10, "verbosity goes here") | ||
|
||
roundtripTest("even, small doubles for the duration", | ||
anOutcome.copy(durationMs = 42)) | ||
|
||
roundtripTest("bigger doubles for the duration", | ||
anOutcome.copy(durationMs = 50000)) | ||
|
||
roundtripTest("uneven doubles for the duration", | ||
anOutcome.copy(durationMs = 42.57)) | ||
|
||
roundtripTest( | ||
"Int.MaxValue duration", | ||
anOutcome.copy(durationMs = Int.MaxValue) | ||
) | ||
roundtripTest( | ||
"Double.MaxValue duration", | ||
anOutcome.copy(durationMs = Double.MaxValue) | ||
) | ||
|
||
private def roundtripTest(name: TestName, input: TestOutcomeNative)(implicit | ||
loc: SourceLocation) = { | ||
|
||
test(name.copy(name = "Roundtrip test - " + name.name)) { | ||
val encoded = TestOutcomeNative.encode(input) | ||
val decoded = TestOutcomeNative.decode(encoded) | ||
|
||
assert.same(input, decoded) | ||
} | ||
} | ||
|
||
} |
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