Skip to content

Commit 345cafb

Browse files
author
Brendan Molloy
committed
Add tests
1 parent e3cfa98 commit 345cafb

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

src/string.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,22 @@ mod tests {
494494
assert_eq!(s2, "abcd efgh");
495495
}
496496

497+
#[test]
498+
fn cmp() {
499+
let s1: String<4> = String::from("abcd");
500+
let s2: String<4> = String::from("zzzz");
501+
502+
assert!(s1 < s2);
503+
}
504+
505+
#[test]
506+
fn cmp_heterogenous_size() {
507+
let s1: String<4> = String::from("abcd");
508+
let s2: String<8> = String::from("zzzz");
509+
510+
assert!(s1 < s2);
511+
}
512+
497513
#[test]
498514
fn debug() {
499515
use core::fmt::Write;

src/vec.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,32 @@ mod tests {
907907
assert_eq!(xs, ys);
908908
}
909909

910+
#[test]
911+
fn cmp() {
912+
let mut xs: Vec<i32, 4> = Vec::new();
913+
let mut ys: Vec<i32, 4> = Vec::new();
914+
915+
assert_eq!(xs, ys);
916+
917+
xs.push(1).unwrap();
918+
ys.push(2).unwrap();
919+
920+
assert!(xs < ys);
921+
}
922+
923+
#[test]
924+
fn cmp_heterogenous_size() {
925+
let mut xs: Vec<i32, 4> = Vec::new();
926+
let mut ys: Vec<i32, 8> = Vec::new();
927+
928+
assert_eq!(xs, ys);
929+
930+
xs.push(1).unwrap();
931+
ys.push(2).unwrap();
932+
933+
assert!(xs < ys);
934+
}
935+
910936
#[test]
911937
fn full() {
912938
let mut v: Vec<i32, 4> = Vec::new();

0 commit comments

Comments
 (0)