pub struct Tdd { /* private fields */ }
Implementations§
source§impl Tdd
impl Tdd
pub fn new() -> Tdd
sourcepub fn describe(
description: &str,
it: &dyn Fn(&mut Tdd) -> &mut Tdd
) -> Result<String, String>
pub fn describe( description: &str, it: &dyn Fn(&mut Tdd) -> &mut Tdd ) -> Result<String, String>
Tdd
z
description
A short description to describe the testit
The callback to executeResult<String, String>
Usage
use unit::Tdd;
fn pythagore(t:&mut Tdd) -> &mut Tdd
{
t.assert
(
8*8+15*15 == 17 * 17,
"The triangle 8 by 15 is rectangle",
"The triangle 8 by 15 is not rectangle",
).assert
(
5*5 + 12*12 == 13*13,
"The triangle 5 by 12 is rectangle",
"The triangle 5 by 12 is not rectangle",
)
}
Tdd::describe
(
"Check the pythagore theorem",
&pythagore,
).ok().expect("A triangle is not rectangle");