Skip to content

Commit

Permalink
name mangling test added
Browse files Browse the repository at this point in the history
  • Loading branch information
dlepex committed Feb 27, 2018
1 parent f444a37 commit 13042e5
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions mangle_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package main

import "testing"

func TestMangleCtor(t *testing.T) {
testcases := [][4]string{
[4]string{"newValOf", "Val", "Int", "newIntOf"},
[4]string{"make", "Val", "Int", "makeInt"},
[4]string{"Make", "Val", "int", "MakeInt"},
[4]string{"ValOfTea", "val", "Int", "IntOfTea"},
}

for _, tc := range testcases {
got := MangleCtorName(tc[0], tc[1], tc[2])
if got != tc[3] {
t.Error(got, tc)
}
}
}

func TestMangleDepType(t *testing.T) {
testcases := [][4]string{
[4]string{"valEntry", "Val", "Int", "intEntry"},
[4]string{"entry", "val", "int", "intEntry"},
[4]string{"ValEntry", "Val", "zzz", "ZzzEntry"},
[4]string{"EntryValName", "Val", "zzz", "EntryZzzName"},
[4]string{"entryValName", "Val", "X", "entryXName"},
}

for _, tc := range testcases {
got := MangleDepTypeName(tc[0], tc[1], tc[2])
if got != tc[3] {
t.Error(got, tc)
}
}
}

0 comments on commit 13042e5

Please sign in to comment.