updated NTOBV and test

This commit is contained in:
Kolby Heacock 2025-11-30 00:51:18 -07:00 committed by Ava Apples Affine
parent 54a0e32fe1
commit d008ce8060

View file

@ -406,7 +406,7 @@ impl VM {
n.0 > u8::MAX.into() || n.0 < 0.0 {
e!("input to NTOBV cannot cleanly convert");
}
Datum::ByteVector(n.0.to_bits().to_be_bytes().to_vec()).into()
Datum::ByteVector(n.0.to_bits().to_ne_bytes().to_vec()).into()
} else {
e!("illegal argument to NTOBV instruction");
}
@ -1111,6 +1111,7 @@ mod tests {
#[test]
fn isa_conversions() {
let mut vm = VM::from(Program(vec![], vec![
// load from stack into expr
Instruction(i::DUPL, vec![Operand(Address::Stack, 0),
Operand(Address::Expr, 0)]),
@ -1120,7 +1121,6 @@ mod tests {
Instruction(i::PUSH, vec![Operand(Address::Expr, 0)]),
// reset expr to original char
Instruction(i::DUPL, vec![Operand(Address::Stack, 1),
Operand(Address::Expr, 0)]),
@ -1158,7 +1158,8 @@ mod tests {
(2, Datum::Number(Number::Flt(Float(97.0))).into()),
(3, Datum::Number(Number::Fra(Fraction(97, 1))).into()),
(4, Datum::String(vec![b'a']).into()),
(5, Datum::Char(b'a').into()),
(5, Datum::Number(Number::Fra(Fraction(97, 1))).into()),
(6, Datum::Char(b'a').into()),
],
syms: vec![],
errr: None,