mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-01-21 12:38:34 +01:00
Fixed parser documentation and interpreter units tests.
This commit is contained in:
parent
47d5a2bee2
commit
2413ad080f
@ -438,7 +438,7 @@ mod tests {
|
||||
symbol_table.insert(var_decl("x", literal("1")));
|
||||
|
||||
let mut context = Context::new(&mut symbol_table, "rad", PRECISION);
|
||||
assert_eq!(context.interpret(vec![stmt]).unwrap().unwrap(), 1);
|
||||
assert_eq!(context.interpret(vec![stmt]).unwrap().unwrap().0, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -475,7 +475,7 @@ mod tests {
|
||||
));
|
||||
|
||||
let mut context = Context::new(&mut symbol_table, "rad", PRECISION);
|
||||
assert_eq!(context.interpret(vec![stmt]).unwrap().unwrap(), 3);
|
||||
assert_eq!(context.interpret(vec![stmt]).unwrap().unwrap().0, 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -15,7 +15,8 @@ pub const DEFAULT_ANGLE_UNIT: &'static str = "rad";
|
||||
/// use kalk::parser;
|
||||
/// let mut parser_context = parser::Context::new();
|
||||
/// let precision = 53;
|
||||
/// assert_eq!(parser::eval(&mut parser_context, "5*3", precision).unwrap().unwrap(), 15);
|
||||
/// let (result, unit) = parser::eval(&mut parser_context, "5*3", precision).unwrap().unwrap();
|
||||
/// assert_eq!(result, 15);
|
||||
/// ```
|
||||
pub struct Context {
|
||||
tokens: Vec<Token>,
|
||||
|
Loading…
Reference in New Issue
Block a user