MCPcopy Create free account
hub / github.com/argumentcomputer/ix / test_decide_sharing_simple

Function test_decide_sharing_simple

crates/ixon/src/sharing.rs:986–999  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

984
985 #[test]
986 fn test_decide_sharing_simple() {
987 // Create expression with repeated subterm
988 let ty = Expr::sort(0);
989 let lam1 = Expr::lam(ty.clone(), Expr::var(0));
990 let lam2 = Expr::lam(ty.clone(), Expr::var(1));
991 let app = Expr::app(lam1, lam2);
992
993 let (info_map, _, topo_order) = analyze_block(&[app], false);
994 let shared = decide_sharing(&info_map, &topo_order);
995
996 // ty (Sort(0)) appears twice, might be shared depending on size
997 // This is a basic smoke test
998 assert!(shared.len() <= info_map.len());
999 }
1000
1001 #[test]
1002 fn test_topological_sort() {

Callers

nothing calls this directly

Calls 7

sortFunction · 0.85
analyze_blockFunction · 0.85
decide_sharingFunction · 0.85
lamFunction · 0.50
varFunction · 0.50
appFunction · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected