Remove superfluous printing from heap_allocation tests

This commit is contained in:
Philipp Oppermann
2020-06-08 12:08:25 +02:00
parent 9809ea57ae
commit e7fd27b648

View File

@@ -7,7 +7,7 @@
extern crate alloc; extern crate alloc;
use alloc::{boxed::Box, vec::Vec}; use alloc::{boxed::Box, vec::Vec};
use blog_os::{allocator::HEAP_SIZE, serial_print, serial_println}; use blog_os::allocator::HEAP_SIZE;
use bootloader::{entry_point, BootInfo}; use bootloader::{entry_point, BootInfo};
use core::panic::PanicInfo; use core::panic::PanicInfo;
@@ -30,34 +30,28 @@ fn main(boot_info: &'static BootInfo) -> ! {
#[test_case] #[test_case]
fn simple_allocation() { fn simple_allocation() {
serial_print!("simple_allocation... ");
let heap_value_1 = Box::new(41); let heap_value_1 = Box::new(41);
let heap_value_2 = Box::new(13); let heap_value_2 = Box::new(13);
assert_eq!(*heap_value_1, 41); assert_eq!(*heap_value_1, 41);
assert_eq!(*heap_value_2, 13); assert_eq!(*heap_value_2, 13);
serial_println!("[ok]");
} }
#[test_case] #[test_case]
fn large_vec() { fn large_vec() {
serial_print!("large_vec... ");
let n = 1000; let n = 1000;
let mut vec = Vec::new(); let mut vec = Vec::new();
for i in 0..n { for i in 0..n {
vec.push(i); vec.push(i);
} }
assert_eq!(vec.iter().sum::<u64>(), (n - 1) * n / 2); assert_eq!(vec.iter().sum::<u64>(), (n - 1) * n / 2);
serial_println!("[ok]");
} }
#[test_case] #[test_case]
fn many_boxes() { fn many_boxes() {
serial_print!("many_boxes... ");
for i in 0..HEAP_SIZE { for i in 0..HEAP_SIZE {
let x = Box::new(i); let x = Box::new(i);
assert_eq!(*x, i); assert_eq!(*x, i);
} }
serial_println!("[ok]");
} }
#[panic_handler] #[panic_handler]