-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
284 additions
and
0 deletions.
There are no files selected for viewing
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
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,15 @@ | ||
fn main(i32, &[&[u8]]) -> i32 { | ||
if badhron_approx_f32(0.f, 0.f) && | ||
badhron_approx_f32(0.f, -0.f) && | ||
badhron_approx_f32(-0.f, 0.f) && | ||
badhron_approx_f32(1.f, 5.f/5.f) && | ||
badhron_approx_f32(-1.f, -5.f/5.f) && | ||
badhron_approx_f32(9.9f, 10.f - 0.1f) && | ||
!badhron_approx_f32(0.f, 0.00001f) && | ||
!badhron_approx_f32(-1.f, 5.f/5.f) && | ||
!badhron_approx_f32(1.f, -5.f/5.f) { | ||
0 | ||
} else { | ||
1 | ||
} | ||
} |
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,15 @@ | ||
fn main(i32, &[&[u8]]) -> i32 { | ||
if badhron_approx_f64(0., 0.) && | ||
badhron_approx_f64(0., -0.) && | ||
badhron_approx_f64(-0., 0.) && | ||
badhron_approx_f64(1., 5./5.) && | ||
badhron_approx_f64(-1., -5./5.) && | ||
badhron_approx_f64(9.9, 10. - 0.1) && | ||
!badhron_approx_f64(0., 0.00001) && | ||
!badhron_approx_f64(-1., 5./5.) && | ||
!badhron_approx_f64(1., -5./5.) { | ||
0 | ||
} else { | ||
1 | ||
} | ||
} |
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,10 @@ | ||
fn main(i32, &[&[u8]]) -> i32 { | ||
if result_equals( | ||
badhron_new_check_result(), | ||
BadhronCheckResult{passed: 0, failed: 0, pending: 0} | ||
) { | ||
0 | ||
} else { | ||
1 | ||
} | ||
} |
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,9 @@ | ||
fn main(i32, &[&[u8]]) -> i32 { | ||
if badhron_create_suite() == 0_u64 && | ||
badhron_create_suite() == 1_u64 && | ||
{badhron_delete_suite(1_u64); badhron_create_suite()} == 2_u64 { | ||
0 | ||
} else { | ||
1 | ||
} | ||
} |
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,12 @@ | ||
fn main(i32, &[&[u8]]) -> i32 { | ||
let first = badhron_create_suite(); | ||
let second = badhron_create_suite(); | ||
|
||
badhron_delete_suite(second); | ||
badhron_delete_suite(first); | ||
|
||
// double delete is noop | ||
badhron_delete_suite(first); | ||
|
||
0 | ||
} |
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,11 @@ | ||
fn main(i32, &[&[u8]]) -> i32 { | ||
let suite = badhron_create_suite(); | ||
let rh = badhron_new_result_handler(suite); | ||
|
||
let ok = rh.suite_id() == suite && | ||
rh.exit_status() == 0; | ||
|
||
rh.print(); | ||
badhron_delete_suite(suite); | ||
if ok { 0 } else { 1 } | ||
} |
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,44 @@ | ||
fn main(i32, &[&[u8]]) -> i32 { | ||
let suite = badhron_create_suite(); | ||
let rh = badhron_new_result_handler(suite); | ||
let mut ok = true; | ||
|
||
// passed | ||
rh.begin_group("group_passed"); | ||
rh.passed(); | ||
rh.passed(); | ||
ok = ok && | ||
result_equals(rh.end_group(), BadhronCheckResult{passed: 2, failed: 0, pending: 0}) && | ||
rh.exit_status() == 0; | ||
|
||
// pending | ||
rh.begin_group("group_pending"); | ||
rh.pending(); | ||
rh.pending(); | ||
ok = ok && | ||
result_equals(rh.end_group(), BadhronCheckResult{passed: 0, failed: 0, pending: 2}) && | ||
rh.exit_status() == 0; | ||
|
||
// failed | ||
rh.begin_group("group_failed"); | ||
rh.failed(); | ||
rh.failed(); | ||
ok = ok && | ||
result_equals(rh.end_group(), BadhronCheckResult{passed: 0, failed: 2, pending: 0}) && | ||
rh.exit_status() != 0; | ||
|
||
// mixed | ||
rh.begin_group("group_mixed"); | ||
rh.failed(); | ||
rh.passed(); | ||
rh.failed(); | ||
rh.pending(); | ||
rh.passed(); | ||
ok = ok && | ||
result_equals(rh.end_group(), BadhronCheckResult{passed: 2, failed: 2, pending: 1}) && | ||
rh.exit_status() != 0; | ||
|
||
rh.print(); | ||
badhron_delete_suite(suite); | ||
if ok { 0 } else { 1 } | ||
} |
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,26 @@ | ||
fn main(i32, &[&[u8]]) -> i32 { | ||
let suite = badhron_create_suite(); | ||
let rh = badhron_new_result_handler(suite); | ||
let mut ok = true; | ||
|
||
// check initial state | ||
ok = ok && | ||
result_equals(rh.end_group(), badhron_new_check_result()) && | ||
rh.exit_status() == 0; | ||
|
||
// mess with the result handler | ||
rh.passed(); | ||
rh.passed(); | ||
rh.failed(); // sets exit status != 0 | ||
rh.pending(); | ||
|
||
// starting a new group resets all previous results (but not the exit status!) | ||
rh.begin_group("group1"); | ||
ok = ok && | ||
result_equals(rh.end_group(), badhron_new_check_result()) && | ||
rh.exit_status() != 0; | ||
|
||
rh.print(); | ||
badhron_delete_suite(suite); | ||
if ok { 0 } else { 1 } | ||
} |
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,67 @@ | ||
fn main(i32, &[&[u8]]) -> i32 { | ||
let suite = badhron_create_suite(); | ||
let rh = badhron_new_result_handler(suite); | ||
let mut ok = true; | ||
|
||
// initial state | ||
ok = ok && rh.split_name() == 0 as &[u8]; | ||
|
||
rh.begin_group("group"); | ||
rh.passed(); | ||
rh.pending(); | ||
|
||
// passed | ||
rh.begin_split("split_passed"); | ||
rh.passed(); | ||
rh.passed(); | ||
ok = ok && | ||
rh.split_name() != 0 as &[u8] && | ||
result_equals(rh.end_split(), BadhronCheckResult{passed: 2, failed: 0, pending: 0}) && | ||
rh.exit_status() == 0; | ||
|
||
// group checks | ||
rh.passed(); | ||
rh.failed(); | ||
|
||
// pending | ||
rh.begin_split("split_pending"); | ||
rh.pending(); | ||
rh.pending(); | ||
ok = ok && | ||
rh.split_name() != 0 as &[u8] && | ||
result_equals(rh.end_split(), BadhronCheckResult{passed: 0, failed: 0, pending: 2}) && | ||
rh.exit_status() != 0; | ||
|
||
// failed | ||
rh.begin_split("split_failed"); | ||
rh.failed(); | ||
rh.failed(); | ||
ok = ok && | ||
rh.split_name() != 0 as &[u8] && | ||
result_equals(rh.end_split(), BadhronCheckResult{passed: 0, failed: 2, pending: 0}) && | ||
rh.exit_status() != 0; | ||
|
||
// mixed | ||
rh.begin_split("split_mixed"); | ||
rh.failed(); | ||
rh.passed(); | ||
rh.failed(); | ||
rh.pending(); | ||
rh.passed(); | ||
ok = ok && | ||
rh.split_name() != 0 as &[u8] && | ||
result_equals(rh.end_split(), BadhronCheckResult{passed: 2, failed: 2, pending: 1}) && | ||
rh.exit_status() != 0; | ||
|
||
// group results | ||
rh.pending(); | ||
rh.pending(); | ||
ok = ok && | ||
rh.split_name() == 0 as &[u8] && | ||
result_equals(rh.end_group(), BadhronCheckResult{passed: 2, failed: 1, pending: 3}) && | ||
rh.exit_status() != 0; | ||
|
||
rh.print(); | ||
badhron_delete_suite(suite); | ||
if ok { 0 } else { 1 } | ||
} |
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,59 @@ | ||
fn main(i32, &[&[u8]]) -> i32 { | ||
let suite = badhron_create_suite(); | ||
let rh = badhron_new_result_handler(suite); | ||
let mut ok = true; | ||
|
||
// initial state | ||
ok = ok && rh.split_name() == 0 as &[u8]; | ||
|
||
rh.begin_group("group"); | ||
|
||
// passed | ||
rh.begin_split("split_passed"); | ||
rh.passed(); | ||
rh.passed(); | ||
ok = ok && | ||
rh.split_name() != 0 as &[u8] && | ||
result_equals(rh.end_split(), BadhronCheckResult{passed: 2, failed: 0, pending: 0}) && | ||
rh.exit_status() == 0; | ||
|
||
// pending | ||
rh.begin_split("split_pending"); | ||
rh.pending(); | ||
rh.pending(); | ||
ok = ok && | ||
rh.split_name() != 0 as &[u8] && | ||
result_equals(rh.end_split(), BadhronCheckResult{passed: 0, failed: 0, pending: 2}) && | ||
rh.exit_status() == 0; | ||
|
||
// failed | ||
rh.begin_split("split_failed"); | ||
rh.failed(); | ||
rh.failed(); | ||
ok = ok && | ||
rh.split_name() != 0 as &[u8] && | ||
result_equals(rh.end_split(), BadhronCheckResult{passed: 0, failed: 2, pending: 0}) && | ||
rh.exit_status() != 0; | ||
|
||
// mixed | ||
rh.begin_split("split_mixed"); | ||
rh.failed(); | ||
rh.passed(); | ||
rh.failed(); | ||
rh.pending(); | ||
rh.passed(); | ||
ok = ok && | ||
rh.split_name() != 0 as &[u8] && | ||
result_equals(rh.end_split(), BadhronCheckResult{passed: 2, failed: 2, pending: 1}) && | ||
rh.exit_status() != 0; | ||
|
||
// group results | ||
ok = ok && | ||
rh.split_name() == 0 as &[u8] && | ||
result_equals(rh.end_group(), badhron_new_check_result()) && | ||
rh.exit_status() != 0; | ||
|
||
rh.print(); | ||
badhron_delete_suite(suite); | ||
if ok { 0 } else { 1 } | ||
} |
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,5 @@ | ||
fn result_equals(res1: BadhronCheckResult, res2: BadhronCheckResult) -> bool { | ||
res1.passed == res2.passed && | ||
res1.failed == res2.failed && | ||
res1.pending == res2.pending | ||
} |