Lines
100 %
Functions
Branches
//! Unit tests for entity-accessor eval handlers.
use crate::ast::{Expr, WasmType};
use crate::runtime::SymbolTable;
use super::meta::{
context_type, entity_count, entity_type, primary_entity_idx, primary_entity_type,
};
use super::split::split_account_name;
#[test]
fn split_account_name_returns_wasm_runtime_string() {
let mut symbols = SymbolTable::new();
let idx = Expr::Number(crate::ast::Fraction::from_integer(1));
let result = split_account_name(&mut symbols, &[idx]).unwrap();
assert_eq!(result, Expr::WasmRuntime(WasmType::StringRef));
}
fn split_account_name_arity_error() {
assert!(split_account_name(&mut symbols, &[]).is_err());
fn test_entity_count_returns_wasm_runtime_i32() {
let result = entity_count(&mut symbols, &[]).unwrap();
assert_eq!(result, Expr::WasmRuntime(WasmType::I32));
fn test_context_type_returns_wasm_runtime_i32() {
let result = context_type(&mut symbols, &[]).unwrap();
fn test_primary_entity_type_returns_wasm_runtime_i32() {
let result = primary_entity_type(&mut symbols, &[]).unwrap();
fn test_primary_entity_idx_returns_wasm_runtime_i32() {
let result = primary_entity_idx(&mut symbols, &[]).unwrap();
fn test_entity_count_arity_error() {
assert!(entity_count(&mut symbols, &[Expr::Nil]).is_err());
fn test_entity_type_arity_error() {
assert!(entity_type(&mut symbols, &[]).is_err());