File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1818 @test length (sorted_nodes) == 3
1919 @test isequal (sorted_nodes[1 ]. rhs, a + b)
2020 @test isequal (sin (sorted_nodes[1 ]. lhs), sorted_nodes[2 ]. rhs)
21+
2122 expr = (a + b)^ (a + b)
2223 sorted_nodes = topological_sort (expr)
2324 @test length (sorted_nodes) == 2
2425 @test isequal (sorted_nodes[1 ]. rhs, a + b)
2526 ab_node = sorted_nodes[1 ]. lhs
2627 @test isequal (ab_node^ ab_node, sorted_nodes[2 ]. rhs)
28+ let_expr = cse (expr)
29+ @test length (let_expr. pairs) == 1
30+ @test isequal (let_expr. pairs[1 ]. rhs, a + b)
31+ corresponding_sym = let_expr. pairs[1 ]. lhs
32+ @test isequal (let_expr. body, corresponding_sym^ corresponding_sym)
33+
34+ expr = a + b
35+ sorted_nodes = topological_sort (expr)
36+ @test length (sorted_nodes) == 1
37+ @test isequal (sorted_nodes[1 ]. rhs, a + b)
38+ let_expr = cse (expr)
39+ @test isempty (let_expr. pairs)
40+ @test isequal (let_expr. body, a + b)
41+
42+ expr = a
43+ sorted_nodes = topological_sort (expr)
44+ @test isempty (sorted_nodes)
45+ let_expr = cse (expr)
46+ @test isempty (let_expr. pairs)
47+ @test isequal (let_expr. body, a)
2748end
You can’t perform that action at this time.
0 commit comments