From cc4c48c6471142cff1f847795626217f6c3c463d Mon Sep 17 00:00:00 2001 From: julia Date: Wed, 4 Sep 2024 15:02:48 +1000 Subject: [PATCH] Add tests --- .../tests/sdf/ch_end_invalid_notify.xml | 19 +++++++++ tool/microkit/tests/sdf/ch_end_invalid_pp.xml | 19 +++++++++ .../microkit/tests/sdf/ch_invalid_element.xml | 19 +++++++++ .../microkit/tests/sdf/ch_not_enough_ends.xml | 18 +++++++++ tool/microkit/tests/sdf/ch_too_many_ends.xml | 20 ++++++++++ tool/microkit/tests/test.rs | 40 +++++++++++++++++++ 6 files changed, 135 insertions(+) create mode 100644 tool/microkit/tests/sdf/ch_end_invalid_notify.xml create mode 100644 tool/microkit/tests/sdf/ch_end_invalid_pp.xml create mode 100644 tool/microkit/tests/sdf/ch_invalid_element.xml create mode 100644 tool/microkit/tests/sdf/ch_not_enough_ends.xml create mode 100644 tool/microkit/tests/sdf/ch_too_many_ends.xml diff --git a/tool/microkit/tests/sdf/ch_end_invalid_notify.xml b/tool/microkit/tests/sdf/ch_end_invalid_notify.xml new file mode 100644 index 000000000..8a0374f81 --- /dev/null +++ b/tool/microkit/tests/sdf/ch_end_invalid_notify.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/tool/microkit/tests/sdf/ch_end_invalid_pp.xml b/tool/microkit/tests/sdf/ch_end_invalid_pp.xml new file mode 100644 index 000000000..b4f27f0e3 --- /dev/null +++ b/tool/microkit/tests/sdf/ch_end_invalid_pp.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/tool/microkit/tests/sdf/ch_invalid_element.xml b/tool/microkit/tests/sdf/ch_invalid_element.xml new file mode 100644 index 000000000..1b4047fd5 --- /dev/null +++ b/tool/microkit/tests/sdf/ch_invalid_element.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/tool/microkit/tests/sdf/ch_not_enough_ends.xml b/tool/microkit/tests/sdf/ch_not_enough_ends.xml new file mode 100644 index 000000000..d4874d8ef --- /dev/null +++ b/tool/microkit/tests/sdf/ch_not_enough_ends.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/tool/microkit/tests/sdf/ch_too_many_ends.xml b/tool/microkit/tests/sdf/ch_too_many_ends.xml new file mode 100644 index 000000000..8f9bd4e00 --- /dev/null +++ b/tool/microkit/tests/sdf/ch_too_many_ends.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + diff --git a/tool/microkit/tests/test.rs b/tool/microkit/tests/test.rs index 8f3c0fcc5..58e0e44d9 100644 --- a/tool/microkit/tests/test.rs +++ b/tool/microkit/tests/test.rs @@ -320,6 +320,46 @@ mod channel { "Error: invalid PD name 'invalidpd' on element 'end': ", ) } + + #[test] + fn test_invalid_element() { + check_error( + "ch_invalid_element.xml", + "Error: invalid XML element 'ending': ", + ) + } + + #[test] + fn test_not_enough_ends() { + check_error( + "ch_not_enough_ends.xml", + "Error: exactly two end elements must be specified on element 'channel': ", + ) + } + + #[test] + fn test_too_many_ends() { + check_error( + "ch_too_many_ends.xml", + "Error: exactly two end elements must be specified on element 'channel': ", + ) + } + + #[test] + fn test_end_invalid_pp() { + check_error( + "ch_end_invalid_pp.xml", + "Error: pp must be 'true'/'false' on element 'end': ", + ) + } + + #[test] + fn test_end_invalid_notify() { + check_error( + "ch_end_invalid_notify.xml", + "Error: notify must be 'true'/'false' on element 'end': ", + ) + } } #[cfg(test)]