mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-09-28 13:00:26 +00:00
Add tests
This commit is contained in:
parent
e3cfa98b2f
commit
345cafbdef
@ -494,6 +494,22 @@ mod tests {
|
||||
assert_eq!(s2, "abcd efgh");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cmp() {
|
||||
let s1: String<4> = String::from("abcd");
|
||||
let s2: String<4> = String::from("zzzz");
|
||||
|
||||
assert!(s1 < s2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cmp_heterogenous_size() {
|
||||
let s1: String<4> = String::from("abcd");
|
||||
let s2: String<8> = String::from("zzzz");
|
||||
|
||||
assert!(s1 < s2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn debug() {
|
||||
use core::fmt::Write;
|
||||
|
26
src/vec.rs
26
src/vec.rs
@ -907,6 +907,32 @@ mod tests {
|
||||
assert_eq!(xs, ys);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cmp() {
|
||||
let mut xs: Vec<i32, 4> = Vec::new();
|
||||
let mut ys: Vec<i32, 4> = Vec::new();
|
||||
|
||||
assert_eq!(xs, ys);
|
||||
|
||||
xs.push(1).unwrap();
|
||||
ys.push(2).unwrap();
|
||||
|
||||
assert!(xs < ys);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cmp_heterogenous_size() {
|
||||
let mut xs: Vec<i32, 4> = Vec::new();
|
||||
let mut ys: Vec<i32, 8> = Vec::new();
|
||||
|
||||
assert_eq!(xs, ys);
|
||||
|
||||
xs.push(1).unwrap();
|
||||
ys.push(2).unwrap();
|
||||
|
||||
assert!(xs < ys);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn full() {
|
||||
let mut v: Vec<i32, 4> = Vec::new();
|
||||
|
Loading…
x
Reference in New Issue
Block a user