testing
Module
Implements various testing utils.
You can import these APIs from the testing
package. For example:
from testing import assert_true
assert_true
assert_true(val: Bool, msg: String) -> Bool
Asserts that the input value is True. If it is not then a message is printed which contains the input message.
Args:
- val (
Bool
): The value to assert to be True. - msg (
String
): The message to be printed if the assertion fails.
Returns:
True if the assert succeeds and False otherwise.
assert_false
assert_false(val: Bool, msg: String) -> Bool
Asserts that the input value is False. If it is not then a message is printed which contains the input message.
Args:
- val (
Bool
): The value to assert to be False. - msg (
String
): The message to be printed if the assertion fails.
Returns:
True if the assert succeeds and False otherwise.
assert_false(val: Bool) -> Bool
Asserts that the input value is False. If it is not then a message is printed.
Args:
- val (
Bool
): The value to assert to be False.
Returns:
True if the assert succeeds and False otherwise.
assert_equal
assert_equal(lhs: Int, rhs: Int) -> Bool
Asserts that the input values are equal. If it is not then a message is printed.
Args:
- lhs (
Int
): The lhs of the equality. - rhs (
Int
): The rhs of the equality.
Returns:
True if the assert succeeds and False otherwise.
assert_equal(lhs: String, rhs: String) -> Bool
Asserts that the input values are equal. If it is not then a message is printed.
Args:
- lhs (
String
): The lhs of the equality. - rhs (
String
): The rhs of the equality.
Returns:
True if the assert succeeds and False otherwise.
assert_equal[type: DType, size: Int](lhs: SIMD[type, size], rhs: SIMD[type, size]) -> Bool
Asserts that the input values are equal. If it is not then a message is printed.
Parameters:
- type (
DType
): The dtype of the left- and right-hand-side SIMD vectors. - size (
Int
): The width of the left- and right-hand-side SIMD vectors.
Args:
- lhs (
SIMD[type, size]
): The lhs of the equality. - rhs (
SIMD[type, size]
): The rhs of the equality.
Returns:
True if the assert succeeds and False otherwise.
assert_not_equal
assert_not_equal(lhs: Int, rhs: Int) -> Bool
Asserts that the input values are not equal. If it is not then a message is printed.
Args:
- lhs (
Int
): The lhs of the inequality. - rhs (
Int
): The rhs of the inequality.
Returns:
True if the assert succeeds and False otherwise.
assert_not_equal(lhs: String, rhs: String) -> Bool
Asserts that the input values are not equal. If it is not then a message is printed.
Args:
- lhs (
String
): The lhs of the inequality. - rhs (
String
): The rhs of the inequality.
Returns:
True if the assert succeeds and False otherwise.
assert_not_equal[type: DType, size: Int](lhs: SIMD[type, size], rhs: SIMD[type, size]) -> Bool
Asserts that the input values are not equal. If it is not then a message is printed.
Parameters:
- type (
DType
): The dtype of the left- and right-hand-side SIMD vectors. - size (
Int
): The width of the left- and right-hand-side SIMD vectors.
Args:
- lhs (
SIMD[type, size]
): The lhs of the inequality. - rhs (
SIMD[type, size]
): The rhs of the inequality.
Returns:
True if the assert succeeds and False otherwise.
assert_almost_equal
assert_almost_equal[type: DType, size: Int](lhs: SIMD[type, size], rhs: SIMD[type, size]) -> Bool
Asserts that the input values are equal up to a tolerance. If it is not then a message is printed.
Parameters:
- type (
DType
): The dtype of the left- and right-hand-side SIMD vectors. - size (
Int
): The width of the left- and right-hand-side SIMD vectors.
Args:
- lhs (
SIMD[type, size]
): The lhs of the equality. - rhs (
SIMD[type, size]
): The rhs of the equality.
Returns:
True if the assert succeeds and False otherwise.