More tests.
This commit is contained in:
@@ -22,7 +22,7 @@ fn test_float() -> Result<(), Box<EvalAltResult>> {
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
fn struct_with_float() -> Result<(), Box<EvalAltResult>> {
|
||||
fn test_struct_with_float() -> Result<(), Box<EvalAltResult>> {
|
||||
#[derive(Clone)]
|
||||
struct TestStruct {
|
||||
x: f64,
|
||||
@@ -64,3 +64,16 @@ fn struct_with_float() -> Result<(), Box<EvalAltResult>> {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_float_func() -> Result<(), Box<EvalAltResult>> {
|
||||
let mut engine = Engine::new();
|
||||
|
||||
engine.register_fn("sum", |x: FLOAT, y: FLOAT, z: FLOAT, w: FLOAT| {
|
||||
x + y + z + w
|
||||
});
|
||||
|
||||
assert_eq!(engine.eval::<FLOAT>("sum(1.0, 2.0, 3.0, 4.0)")?, 10.0);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user