dev/asset-management (#6)
Co-authored-by: Nilton Constantino <nilton.constantino@visma.com> Reviewed-on: #6
This commit is contained in:
@@ -666,6 +666,9 @@ impl VirtualMachine {
|
||||
|
||||
pub fn pop_integer(&mut self) -> Result<i64, String> {
|
||||
let val = self.pop()?;
|
||||
if let Value::Boolean(b) = val {
|
||||
return Ok(if b { 1 } else { 0 });
|
||||
}
|
||||
val.as_integer().ok_or_else(|| "Expected integer".into())
|
||||
}
|
||||
|
||||
@@ -688,9 +691,9 @@ impl VirtualMachine {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::virtual_machine::Value;
|
||||
use crate::prometeu_os::NativeInterface;
|
||||
use crate::hardware::HardwareBridge;
|
||||
use crate::prometeu_os::NativeInterface;
|
||||
use crate::virtual_machine::Value;
|
||||
|
||||
struct MockNative;
|
||||
impl NativeInterface for MockNative {
|
||||
@@ -709,6 +712,8 @@ mod tests {
|
||||
fn pad_mut(&mut self) -> &mut crate::hardware::Pad { todo!() }
|
||||
fn touch(&self) -> &crate::hardware::Touch { todo!() }
|
||||
fn touch_mut(&mut self) -> &mut crate::hardware::Touch { todo!() }
|
||||
fn assets(&self) -> &crate::hardware::AssetManager { todo!() }
|
||||
fn assets_mut(&mut self) -> &mut crate::hardware::AssetManager { todo!() }
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user