mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
clarify comments in tests
This commit is contained in:
parent
f813591042
commit
5bc75b7a03
1 changed files with 14 additions and 10 deletions
|
@ -72,13 +72,14 @@ fn test_memory_fill() {
|
|||
state.value_store.push(Value::I32(SIZE));
|
||||
|
||||
// before the instruction, the memory is all zeros
|
||||
let slice = &state.memory[destination as usize..][..SIZE as usize];
|
||||
assert_eq!(slice, &[0; SIZE as usize]);
|
||||
let memory_before = &state.memory[destination as usize..][..SIZE as usize];
|
||||
assert_eq!(memory_before, &[0; SIZE as usize]);
|
||||
|
||||
state.execute_next_instruction(&module).unwrap();
|
||||
|
||||
let slice = &state.memory[destination as usize..][..SIZE as usize];
|
||||
assert_eq!(slice, &[byte_value as u8; SIZE as usize])
|
||||
// after the fill, the same memory range is now all 0xAA bytes
|
||||
let memory_after = &state.memory[destination as usize..][..SIZE as usize];
|
||||
assert_eq!(memory_after, &[byte_value as u8; SIZE as usize])
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -103,16 +104,19 @@ fn test_memory_copy() {
|
|||
state.value_store.push(Value::I32(source));
|
||||
state.value_store.push(Value::I32(SIZE));
|
||||
|
||||
// before the instruction, the memory is all zeros
|
||||
let slice = &mut state.memory[source as usize..][..SIZE as usize];
|
||||
assert_eq!(slice, &[0; SIZE as usize]);
|
||||
// fill the source slice with 0xAA bytes
|
||||
let source_slice = &mut state.memory[source as usize..][..SIZE as usize];
|
||||
source_slice.fill(0xAA);
|
||||
|
||||
slice.fill(0xAA);
|
||||
// before the copy, the destination slice is all 0x00 bytes
|
||||
let dest_slice = &state.memory[destination as usize..][..SIZE as usize];
|
||||
assert_eq!(dest_slice, &[0x00; SIZE as usize]);
|
||||
|
||||
state.execute_next_instruction(&module).unwrap();
|
||||
|
||||
let slice = &state.memory[destination as usize..][..SIZE as usize];
|
||||
assert_eq!(slice, &[0xAA; SIZE as usize])
|
||||
// after the copy, the destination slice is all 0xAA bytes
|
||||
let dest_slice = &state.memory[destination as usize..][..SIZE as usize];
|
||||
assert_eq!(dest_slice, &[0xAA; SIZE as usize])
|
||||
}
|
||||
|
||||
fn test_load(load_op: OpCode, ty: ValueType, data: &[u8], addr: u32, offset: u32) -> Value {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue