mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-18 18:10:14 +01:00
fix error message, add test
This commit is contained in:
parent
03f7495695
commit
942968fcf4
|
@ -80,3 +80,16 @@ impl Connection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use crate::packet::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn send_fake() {
|
||||||
|
let data: &[u8] = &[0u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
|
let packet = Packet::try_from(data).unwrap();
|
||||||
|
Connection::Fake.send(packet).unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -79,12 +79,12 @@ pub trait Grid<T> {
|
||||||
assert!(
|
assert!(
|
||||||
x < self.width(),
|
x < self.width(),
|
||||||
"cannot access index [{x}, {y}] because x is outside of bounds 0..{}",
|
"cannot access index [{x}, {y}] because x is outside of bounds 0..{}",
|
||||||
self.width()
|
self.width() - 1
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
y < self.height(),
|
y < self.height(),
|
||||||
"cannot access byte [{x}, {y}] because y is outside of bounds 0..{}",
|
"cannot access index [{x}, {y}] because y is outside of bounds 0..{}",
|
||||||
self.height()
|
self.height() - 1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue