fspl/generator/type_test.go

52 lines
859 B
Go

package generator
import "testing"
func TestType (test *testing.T) {
testString (test,
`%AllFloats = type { float, double }
%Bool = type i8
%Byte = type i8
%Index = type i64
%Rune = type i32
%AllInts = type { %Bool, %Byte, %Index, %Rune, i64, i64, i8, i16, i32, i64, i8, i16, i32, i64 }
%Path = type { ptr, i64 }
%Pegasus = type { ptr, ptr, ptr, ptr, ptr }
%Point = type { i64, i64 }
%Quadrangle = type [4 x %Point]
%Rectangle = type { %Point, %Point }
%String = type { ptr, i64 }
`,
`
Point: (x:Int y:Int)
Pegasus: (
[clear clouds:*:Point]
[fly rings:*:Point]
[fall distance:Int]
[complete]:Bool)
Rectangle: (
min:Point
max:Point)
AllInts: (
bool:Bool
byte:Byte
index:Index
rune:Rune
word:Int
uword:UInt
i8:I8
i16:I16
i32:I32
i64:I64
u8:U8
u16:U16
u32:U32
u64:U64)
AllFloats: (
f32:F32
f64:F64)
Path: *:Point
Quadrangle: 4:Point
`)
}