diff --git a/stages/lisp0/Makefile b/stages/lisp0/Makefile index 19318f4..216c00f 100644 --- a/stages/lisp0/Makefile +++ b/stages/lisp0/Makefile @@ -14,7 +14,7 @@ lisp1.o: lisp1.asm nasm -g -f elf64 -o lisp1.o lisp1.asm test1: test1.bin - ./test1.bin + ./test1.bin --nocapture --test-threads=1 clean: rm -f lisp.o test.bin lisp1.o test1.bin diff --git a/stages/lisp0/test.rs b/stages/lisp0/test.rs index 6445b69..10558da 100644 --- a/stages/lisp0/test.rs +++ b/stages/lisp0/test.rs @@ -250,61 +250,61 @@ mod tests { use std::mem::ManuallyDrop; use std::os::fd::AsRawFd; - // #[test] - // fn test_heap_alloc_dealloc() { - // let small = Box::new_in(42u8, HeapAlloc); - // let ptr_sized = Box::new_in(42usize, HeapAlloc); - // let big = Box::new_in([0u8; 48], HeapAlloc); - // let large = Box::new_in([0u8; 1024], HeapAlloc); - // let page_sized = Box::new_in([0u8; 4096], HeapAlloc); - // assert_eq!(*small, 42); - // assert_ne!( - // Box::as_ptr(&small) as *const (), - // Box::as_ptr(&ptr_sized) as *const () - // ); - // let small_ptr = Box::as_ptr(&small) as *const (); - // drop(small); - // let small2 = Box::new_in(43u8, HeapAlloc); - // assert_eq!(*small2, 43); - // assert_eq!(small_ptr, Box::as_ptr(&small2) as *const ()); - // } + #[test] + fn test_heap_alloc_dealloc() { + let small = Box::new_in(42u8, HeapAlloc); + let ptr_sized = Box::new_in(42usize, HeapAlloc); + let big = Box::new_in([0u8; 48], HeapAlloc); + let large = Box::new_in([0u8; 1024], HeapAlloc); + let page_sized = Box::new_in([0u8; 4096], HeapAlloc); + assert_eq!(*small, 42); + assert_ne!( + Box::as_ptr(&small) as *const (), + Box::as_ptr(&ptr_sized) as *const () + ); + let small_ptr = Box::as_ptr(&small) as *const (); + drop(small); + let small2 = Box::new_in(43u8, HeapAlloc); + assert_eq!(*small2, 43); + assert_eq!(small_ptr, Box::as_ptr(&small2) as *const ()); + } - // #[test] - // fn source() { - // let mut file = std::fs::File::open("lisp1.asm").unwrap(); - // unsafe { - // init_source(&raw mut IFILE, file.as_raw_fd()); - // let SourceIterResult { c, some } = getc(); - // assert!(*some); - // assert_eq!(c, b'd'); - // let SourceIterResult { c, some } = peekc(); - // assert!(*some); - // assert_eq!(c, b'e'); - // let SourceIterResult { c, some } = getc(); - // assert!(*some); - // assert_eq!(c, b'e'); - // } - // } + #[test] + fn source() { + let mut file = std::fs::File::open("lisp1.asm").unwrap(); + unsafe { + init_source(&raw mut IFILE, file.as_raw_fd()); + let SourceIterResult { c, some } = getc(); + assert!(*some); + assert_eq!(c, b'd'); + let SourceIterResult { c, some } = peekc(); + assert!(*some); + assert_eq!(c, b'e'); + let SourceIterResult { c, some } = getc(); + assert!(*some); + assert_eq!(c, b'e'); + } + } - // #[test] - // fn parse_list() { - // let file = ManuallyDrop::new(File::open("tests/list.l").unwrap()); - // unsafe { - // init_source(&raw mut IFILE, file.as_raw_fd()); - // let obj = parse_next_token(); - // println!("{:?}", obj); - // } - // } + #[test] + fn parse_list() { + let file = ManuallyDrop::new(File::open("tests/list.l").unwrap()); + unsafe { + init_source(&raw mut IFILE, file.as_raw_fd()); + let obj = parse_next_token(); + println!("{:?}", obj); + } + } - // #[test] - // fn parse_quoted_list() { - // let file = ManuallyDrop::new(File::open("tests/quoted-list.l").unwrap()); - // unsafe { - // init_source(&raw mut IFILE, file.as_raw_fd()); - // let obj = parse_next_token(); - // println!("{:?}", obj); - // } - // } + #[test] + fn parse_quoted_list() { + let file = ManuallyDrop::new(File::open("tests/quoted-list.l").unwrap()); + unsafe { + init_source(&raw mut IFILE, file.as_raw_fd()); + let obj = parse_next_token(); + println!("{:?}", obj); + } + } #[test] fn parse_atom() { @@ -316,23 +316,23 @@ mod tests { } } - // #[test] - // fn parse_pair() { - // let file = ManuallyDrop::new(File::open("tests/pair.l").unwrap()); - // unsafe { - // init_source(&raw mut IFILE, file.as_raw_fd()); - // let obj = parse_next_token(); - // println!("{:?}", obj); - // } - // } + #[test] + fn parse_pair() { + let file = ManuallyDrop::new(File::open("tests/pair.l").unwrap()); + unsafe { + init_source(&raw mut IFILE, file.as_raw_fd()); + let obj = parse_next_token(); + println!("{:?}", obj); + } + } - // #[test] - // fn parse_big_number() { - // let file = ManuallyDrop::new(File::open("tests/big-number.l").unwrap()); - // unsafe { - // init_source(&raw mut IFILE, file.as_raw_fd()); - // let obj = parse_next_token(); - // println!("{:?}", obj); - // } - // } + #[test] + fn parse_big_number() { + let file = ManuallyDrop::new(File::open("tests/big-number.l").unwrap()); + unsafe { + init_source(&raw mut IFILE, file.as_raw_fd()); + let obj = parse_next_token(); + println!("{:?}", obj); + } + } }