HedgehogSuite
Type members
Inherited classlikes
- Value parameters:
- name
The name of this fixture, used for displaying an error message if
beforeAll()
orafterAll()
fail.
- Inherited from:
- Suite
- Inherited from:
- SuiteTransforms
- Inherited from:
- ValueTransforms
Inherited types
Value members
Concrete methods
Runs a hedgehog property-based test.
Runs a hedgehog property-based test.
- Value parameters:
- loc
The location in the test suite source file
- prop
The property under test
- withConfig
A function with which to change the test PropertyConfig
- See also:
hedgehog.runner.property
Inherited methods
Alias for Result.Failure
Alias for Result.Failure
- See also:
See hedgehog.core.Result.Failure
- Inherited from:
- HedgehogAssertions
Runs once after all test cases and after all suite-local fixtures have been tear down.
Runs once after all test cases and after all suite-local fixtures have been tear down.
- Inherited from:
- Suite
Alias for Result.all
Alias for Result.all
- See also:
hedgehog.core.Result.all
- Inherited from:
- HedgehogAssertions
Alias for Result.any
Alias for Result.any
- See also:
hedgehog.core.Result.any
- Inherited from:
- HedgehogAssertions
Fails the test with a failure Result when cond
is false
.
Fails the test with a failure Result when cond
is false
.
- Returns:
Success iff cond is true. Failure otherwise.
- Inherited from:
- HedgehogAssertions
Fails the test if obtained
and expected
are non-equal using ==
.
Fails the test if obtained
and expected
are non-equal using ==
.
- Value parameters:
- expected
The expected value
- obtained
The actual value
- Returns:
Success iff obtained == expected. Failure otherwise.
- Inherited from:
- HedgehogAssertions
Asserts that two elements are equal using ==
equality.
Asserts that two elements are equal using ==
equality.
The "expected" value (second argument) must have the same type or be a subtype of the "obtained" value (first argument). For example:
assertEquals(Option(1), Some(1)) // OK
assertEquals(Some(1), Option(1)) // Error: Option[Int] is not a subtype of Some[Int]
Use assertEquals[Any, Any](a, b)
as an escape hatch to compare two
values of different types. For example:
val a: Either[List[String], Int] = Right(42)
val b: Either[String, Int] = Right(42)
assertEquals[Any, Any](a, b) // OK
assertEquals(a, b) // Error: Either[String, Int] is not a subtype of Either[List[String], Int]
- Inherited from:
- Assertions
Asserts that two doubles are equal to within a positive delta. If the expected value is infinity then the delta value is ignored. NaNs are considered equal: assertEquals(Double.NaN, Double.NaN, *) passes.
Asserts that two doubles are equal to within a positive delta. If the expected value is infinity then the delta value is ignored. NaNs are considered equal: assertEquals(Double.NaN, Double.NaN, *) passes.
- Inherited from:
- Assertions
Asserts that two floats are equal to within a positive delta. If the expected value is infinity then the delta value is ignored. NaNs are considered equal: assertEquals(Float.NaN, Float.NaN, *) passes.
Asserts that two floats are equal to within a positive delta. If the expected value is infinity then the delta value is ignored. NaNs are considered equal: assertEquals(Float.NaN, Float.NaN, *) passes.
- Inherited from:
- Assertions
Asserts two strings are equal.
Asserts two strings are equal.
- Value parameters:
- expected
The expected value
- obtained
The actual string
- Returns:
Success iff actual is obtained. Failure otherwise.
- Inherited from:
- HedgehogAssertions
Asserts two values are nonequal.
Asserts two values are nonequal.
- Value parameters:
- ev
Ensures that obtained and expected are of the same type.
- expected
The expected value
- obtained
The actual value
- Returns:
Success iff obtained != actua.
- Inherited from:
- HedgehogAssertions
- Inherited from:
- Assertions
Runs once before all test cases and before all suite-local fixtures are setup. An error in this method aborts the test suite.
Runs once before all test cases and before all suite-local fixtures are setup. An error in this method aborts the test suite.
- Inherited from:
- Suite
Runs before each individual test case. An error in this method aborts the test case.
Runs before each individual test case. An error in this method aborts the test case.
- Inherited from:
- Suite
Alias for Result.diff
Alias for Result.diff
- See also:
hedgehog.core.Result.diff
- Inherited from:
- HedgehogAssertions
Asserts two doubles are equal +- some erorr value.
Asserts two doubles are equal +- some erorr value.
- Value parameters:
- delta
The error allowed for double == comparison. Default is 0.00.
- expected
The expected value.
- obtained
The actual value.
- Returns:
Success iff obtained approximately equals expected +- delta. Failure otherwis
- Inherited from:
- HedgehogAssertions
Float specialized version of HedgehogAssertions.assertEquals.
Float specialized version of HedgehogAssertions.assertEquals.
Asserts two floats are equal within +- some error value.
- Value parameters:
- delta
The error allowed for float == comparison. Default is 0.0f
- expected
The expected value
- obtained
The actual value
- Returns:
Success iff obtained approximately equals expected +- delta. Failure otherwise.
- Inherited from:
- HedgehogAssertions
Alias for Result.diffNamed
Alias for Result.diffNamed
- See also:
hedgehog.core.Result.diffNamed
- Inherited from:
- HedgehogAssertions
Alias for Result.error
Alias for Result.error
- See also:
hedgehog.core.Result.error
- Inherited from:
- HedgehogAssertions
Fails a test with the given message
Fails a test with the given message
- Returns:
Failure, always.
- Inherited from:
- HedgehogAssertions
Fails a test.
Fails a test.
Analagous to munit.Assertions.fail.
- Value parameters:
- cause
An optional underlying exception to use as the cause of the failure.
- message
The message to include in the failure.
- Returns:
Failure, always.
- Inherited from:
- HedgehogAssertions
- Inherited from:
- Assertions
Alias for Result.failure
Alias for Result.failure
- See also:
hedgehog.core.Result.failure
- Inherited from:
- HedgehogAssertions
- Inherited from:
- Assertions
Functinonal fixtures that can be reused for individual test cases or entire suites.
Functinonal fixtures that can be reused for individual test cases or entire suites.
- Inherited from:
- Suite
Alias for Result.success
Alias for Result.success
- See also:
hedgehog.core.Result.success
- Inherited from:
- HedgehogAssertions
Turns off hedgehog munit-like assertions, so users can use both property- and non-property- based-tests in their test suites. By using the passed assertions parameter, all the standard munit assertions that do not return unit are available, despite name ambiguities.
Turns off hedgehog munit-like assertions, so users can use both property- and non-property- based-tests in their test suites. By using the passed assertions parameter, all the standard munit assertions that do not return unit are available, despite name ambiguities.
==Usage==
test("1 + 1 is 2"){
withMunitAssertions{ assertions =>
assertEquals(1 + 1, 2)
}
}
- Value parameters:
- body
a test body, taking an assertions parameter
- Inherited from:
- HedgehogAssertions
Deprecated and Inherited methods
Fails the test with a failure Result when cond
is false
.
Fails the test with a failure Result when cond
is false
.
Analagous to munit.Assertions.assert.
Only the condition is used. Clues are ignored.
- Value parameters:
- clue
ignored -- usage triggers the deprecation warning
- Returns:
Success iff cond is true. Failure otherwise.
- Deprecated
- Inherited from:
- HedgehogAssertions
Fails the test if obtained
and expected
are non-equal using ==
.
Fails the test if obtained
and expected
are non-equal using ==
.
Analagous to munit.Assertions.assert.
Only the obtained and expected values are used.
- Value parameters:
- clue
Ignored -- Triggers deprecation warning
- ev
Evidence that A and B are of the same type for the comparison to be valid.
- obtained
The actual value
- Returns:
Success iff obtained == expected. Failure otherwise.
- Deprecated
- Inherited from:
- HedgehogAssertions
Double specialized version of HedgehogAssertions.assertEquals
.
Double specialized version of HedgehogAssertions.assertEquals
.
Asserts two double values are equal +- some error value.
Analagous to munit.Assertions.assertEqualsDouble.
Only the obtained, expected and delta parameters are used.
- Value parameters:
- clue
Ignored -- usage triggers a deprecation warning
- delta
The error allowed for double == comparison.
- expected
The expected value.
- obtained
The actual value.
- Returns:
Success iff obtained approximately equals expected +- delta. Failure otherwise.
- Deprecated
- Inherited from:
- HedgehogAssertions
Float specialized version of assertEquals.
Float specialized version of assertEquals.
Asserts two floats are equal within +- some error value.
Analagous to munit.Assertions.assertEqualsFloat.
- Value parameters:
- clue
Ignored -- usage triggers deprecation warning
- delta
The error allowed for float == comparison.
- expected
The expected value
- obtained
The actual value
- Returns:
Success iff obtained approximately equals expected +- delta. Failure otherwise.
- Deprecated
- Inherited from:
- HedgehogAssertions
Asserts two strings are equal without outputting a diff.
Asserts two strings are equal without outputting a diff.
Analagous to munit.Assertions.assertNoDiff.
- Value parameters:
- clue
Ignored -- usage triggers a deprecation warning
- expected
The expected string
- obtained
The actual string
- Returns:
Success iff actual is obtained. Failure otherwise.
- Deprecated
- Inherited from:
- HedgehogAssertions
Asserts obtained is not equal to expected using ==.
Asserts obtained is not equal to expected using ==.
Analagous to munit.Assertions.notEquals.
- Value parameters:
- clue
Ignored -- Usage triggers a deprecation warning
- ev
Evidence that obtained and expected are of the same type.
- expected
The expected value
- obtained
The actual value
- Returns:
Success iff obtained != expected. Failure otherwise.
- Deprecated
- Inherited from:
- HedgehogAssertions
Inherited fields
Alias for Result.Success
Alias for Result.Success
- See also:
hedgehog.core.Result.Success
- Inherited from:
- HedgehogAssertions