Add tests for task 1 and 2

This commit is contained in:
2018-05-22 01:42:28 +02:00
parent 2a37620224
commit a65ab6aafa
9 changed files with 311 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
use std::ops;
use Result;
use binread::BinReadable;
@@ -45,6 +47,14 @@ impl Block {
}
}
impl ops::Index<usize> for Block {
type Output = u8;
fn index(&self, index: usize) -> &<Self as ops::Index<usize>>::Output {
return &self.source[index];
}
}
impl BinReadable for Block {
fn get(&mut self) -> Result<u8> {
if self.pointer >= self.length {

View File

@@ -9,3 +9,5 @@ pub mod frame;
pub mod netstack;
type Result<T> = ::std::result::Result<T, &'static str>;
pub use machine::Machine;