1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//! Testing framework for the Game Boy Advance.
//!
//! This crate enables developers to run tests directly on the Game Boy Advance (or on a Game Boy
//! Advance emulator). To accomplish this, the crate provides both a test macro and a test runner.
//!
//! # Test Macro
//! Instead of using the default `#[test]` macro, a custom `#[test]` macro is provided. It must be
//! used to create tests that can be run by the test runner.
//!
//! This custom `#[test]` macro supports the same testing attributes as the default macro.
//! Specifically, both `#[ignore]` and `#[should_panic]` are supported.
//!
//! In order to use the `#[test]` macro, the `macros` feature must be enabled. It is enabled by
//! default.
//!
//! ## Example
//! A very simple test can be written as follows:
//!
//! ```
//! // A very simple function to test.
//! pub fn add(left: usize, right: usize) -> usize {
//! left + right
//! }
//!
//! #[cfg(test)]
//! mod tests {
//! use super::add;
//! use gba_test::test;
//!
//! #[test]
//! fn it_works() {
//! let result = add(2, 2);
//! assert_eq!(result, 4);
//! }
//! }
//! ```
//!
//! The `#[test]` macro will pass this test to the test runner.
//!
//! # Test Runner
//! In order to run the tests you define, you must use the test runner provided by this crate. This
//! test runner is created using the unstable
//! [`custom_test_frameworks`](https://doc.rust-lang.org/unstable-book/language-features/custom-test-frameworks.html)
//! language feature.
//!
//! ## Example
//! ```
//! #![no_std]
//! #![cfg_attr(test, no_main)]
//! #![cfg_attr(test, feature(custom_test_frameworks))]
//! #![cfg_attr(test, test_runner(gba_test::runner))]
//! #![cfg_attr(test, reexport_test_harness_main = "test_harness")]
//!
//! #[cfg(test)]
//! #[no_mangle]
//! pub fn main() {
//! test_harness()
//! }
//! ```
//!
//! This will run all tests defined within your project.
//!
//! Note that this can be done in libraries, as defining a `main()` function using `#[cfg(test)]`
//! will not cause any problems for downstream users.
//!
//! # Stability
//! This library relies the following unstable language feature:
//! - [`custom_test_frameworks`](https://doc.rust-lang.org/unstable-book/language-features/custom-test-frameworks.html)
//!
//! As such, the stability cannot be guaranteed. This feature is subject to change at any time,
//! potentially breaking this framework.
extern crate self as gba_test;
pub use test;
pub use runner;
pub use Termination;
pub use ;
pub use ;
use ;