Skip to content

Commit

Permalink
ir/types: Fix test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
mewmew committed Dec 30, 2016
1 parent 71f8b3a commit c583f0d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
27 changes: 17 additions & 10 deletions asm/example_test.go
Expand Up @@ -23,10 +23,11 @@ func Example() {
// &ir.Global{
// Name: "seed",
// Typ: &types.PointerType{
// Elem: &types.IntType{Size:32},
// Name: "",
// Elem: &types.IntType{Name:"", Size:32},
// AddrSpace: 0,
// },
// Content: &types.IntType{Size:32},
// Content: &types.IntType{Name:"", Size:32},
// Init: &constant.Int{
// Typ: &types.IntType{(CYCLIC REFERENCE)},
// X: &big.Int{},
Expand All @@ -39,24 +40,27 @@ func Example() {
// Parent: &ir.Module{(CYCLIC REFERENCE)},
// Name: "abs",
// Typ: &types.PointerType{
// Name: "",
// Elem: &types.FuncType{
// Ret: &types.IntType{Size:32},
// Name: "",
// Ret: &types.IntType{Name:"", Size:32},
// Params: {
// &types.Param{
// Name: "x",
// Typ: &types.IntType{Size:32},
// Typ: &types.IntType{Name:"", Size:32},
// },
// },
// Variadic: false,
// },
// AddrSpace: 0,
// },
// Sig: &types.FuncType{
// Ret: &types.IntType{Size:32},
// Name: "",
// Ret: &types.IntType{Name:"", Size:32},
// Params: {
// &types.Param{
// Name: "x",
// Typ: &types.IntType{Size:32},
// Typ: &types.IntType{Name:"", Size:32},
// },
// },
// Variadic: false,
Expand All @@ -67,16 +71,19 @@ func Example() {
// Parent: &ir.Module{(CYCLIC REFERENCE)},
// Name: "rand",
// Typ: &types.PointerType{
// Name: "",
// Elem: &types.FuncType{
// Ret: &types.IntType{Size:32},
// Name: "",
// Ret: &types.IntType{Name:"", Size:32},
// Params: {
// },
// Variadic: false,
// },
// AddrSpace: 0,
// },
// Sig: &types.FuncType{
// Ret: &types.IntType{Size:32},
// Name: "",
// Ret: &types.IntType{Name:"", Size:32},
// Params: {
// },
// Variadic: false,
Expand All @@ -97,7 +104,7 @@ func Example() {
// Name: "2",
// X: &ir.InstLoad{(CYCLIC REFERENCE)},
// Y: &constant.Int{
// Typ: &types.IntType{Size:32},
// Typ: &types.IntType{Name:"", Size:32},
// X: &big.Int{
// neg: false,
// abs: {0x15a4e35},
Expand All @@ -109,7 +116,7 @@ func Example() {
// Name: "3",
// X: &ir.InstMul{(CYCLIC REFERENCE)},
// Y: &constant.Int{
// Typ: &types.IntType{Size:32},
// Typ: &types.IntType{Name:"", Size:32},
// X: &big.Int{
// neg: false,
// abs: {0x1},
Expand Down
4 changes: 2 additions & 2 deletions ir/types/types_test.go
Expand Up @@ -154,8 +154,8 @@ func TestStructTypeString(t *testing.T) {
want string
typ *types.StructType
}{
{want: "{i32, i8*}", typ: types.NewStruct(types.I32, types.NewPointer(types.I8))},
{want: "{i32, i16, i8}", typ: types.NewStruct(types.I32, types.I16, types.I8)},
{want: "{ i32, i8* }", typ: types.NewStruct(types.I32, types.NewPointer(types.I8))},
{want: "{ i32, i16, i8 }", typ: types.NewStruct(types.I32, types.I16, types.I8)},
{want: "{}", typ: types.NewStruct()},
}
for i, g := range golden {
Expand Down

0 comments on commit c583f0d

Please sign in to comment.