MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_global_put_and_get_array

Function test_global_put_and_get_array

core/src/compiler/syms.rs:1046–1063  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1044
1045 #[test]
1046 fn test_global_put_and_get_array() -> Result<()> {
1047 let upcalls = HashMap::default();
1048 let mut global = GlobalSymtable::new(upcalls);
1049
1050 let reg = global.put_global(
1051 SymbolKey::from("arr"),
1052 SymbolPrototype::Array(ArrayInfo { subtype: ExprType::Integer, ndims: 2 }),
1053 )?;
1054 assert_eq!(Register::global(0).unwrap(), reg);
1055
1056 let (got_reg, proto) = global.get_global(&VarRef::new("arr", None)).unwrap();
1057 assert_eq!(Register::global(0).unwrap(), got_reg);
1058 let SymbolPrototype::Array(info) = proto else { panic!("Expected Array prototype") };
1059 assert_eq!(ExprType::Integer, info.subtype);
1060 assert_eq!(2, info.ndims);
1061
1062 Ok(())
1063 }
1064
1065 #[test]
1066 fn test_local_put_and_get_array() -> Result<()> {

Callers

nothing calls this directly

Calls 2

put_globalMethod · 0.80
get_globalMethod · 0.45

Tested by

no test coverage detected