- fraction type renamed as FractionType and moved from operator-fraction.go to fraction-type.go - ListType moved from operator-list.go to list-type.go - all test file were renamed adding the "t_" prefix - defined a test template in file t_temple_test.go - new test file t_relational_test.go where relational tests are collected - lists can now compared as set using operators <, <=, >, and >= (IMPORTANT: here = menas same content, not same list)
31 lines
653 B
Go
31 lines
653 B
Go
// Copyright (c) 2024 Celestino Amoroso (celestino.amoroso@gmail.com).
|
|
// All rights reserved.
|
|
|
|
// t_graph_test.go
|
|
package expr
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestGraph(t *testing.T) {
|
|
// tk0 := NewToken(0, 0, SymChangeSign, "-")
|
|
tk1 := NewValueToken(0, 0, SymInteger, "100", 100)
|
|
tk2 := NewToken(0, 0, SymPlus, "+")
|
|
tk3 := NewValueToken(0, 0, SymInteger, "200", 200)
|
|
|
|
tree := NewAst()
|
|
// tree.addToken(tk0)
|
|
tree.addToken(tk1)
|
|
tree.addToken(tk2)
|
|
tree.addToken(tk3)
|
|
tk4 := NewToken(0, 0, SymPlus, "-")
|
|
tk5 := NewValueToken(0, 0, SymInteger, "50", 50)
|
|
tree.addToken(tk4)
|
|
tree.addToken(tk5)
|
|
|
|
g := BuildGraph(tree.root)
|
|
fmt.Println(g)
|
|
}
|