func TestTypeInfo386(t *testing.T) {
	expectTypeInfoMatch(t, "uint64_t", encULongLong)
	expectTypeInfoMatch(t, "int64_t", encLongLong)
}
TestTypeInfo386 tests that our expectations for
type encodings are actually correct.
package objc
import (
	"bytes"
	"errors"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"testing"
)
var prog = `
#include <objc/runtime.h>
#include <stdio.h>
#import <Foundation/Foundation.h>
@interface TestObject : NSObject {
}
- (void) testMethod:(__TEST_TYPE__)arg;
@end
@implementation TestObject 
- (void) testMethod:(__TEST_TYPE__)arg {
}
@end
int main(int argc, char *argv[]) {
	Method m = class_getInstanceMethod([TestObject class], @selector(testMethod:));;
	printf("%s\n", method_getTypeEncoding(m));
}`
func typeInfoForCType(ctype string) (string, error) {
	tempDir, err := ioutil.TempDir("", "typeinfo")
	if err != nil {
		return "", err
	}
	defer os.RemoveAll(tempDir)
	progName := filepath.Join(tempDir, "prog")
	args := []string{
		"-x", "objective-c",
		"-arch", "i386",
		"-lobjc",
		"-D__TEST_TYPE__=" + ctype,
		"-",  
		"-o", progName,
	}
	cmd := exec.Command("clang", args...)
	cmd.Stdin = bytes.NewBufferString(prog)
	buf, err := cmd.CombinedOutput()
	if err != nil {
		return "", errors.New(string(buf))
	}
	buf, err = exec.Command(progName).Output()
	if err != nil {
		return "", err
	}
	return string(buf), nil
}
func expectTypeInfoMatch(t *testing.T, ctype string, enc string) {
	typeInfo, err := typeInfoForCType(ctype)
	if err != nil {
		t.Fatalf("unable to exec test program: %v", err)
		return
	}
	sti := simplifyTypeInfo(typeInfo)
	prefix := sti[0:3]
	if prefix != "v@:" {
		t.Fatalf("bad prefix: %v", prefix)
	}
	actualEnc := string(sti[3])
	if enc != actualEnc {
		t.Fatalf("bad typeinfo for %v; got %v, expected %v", ctype, actualEnc, enc)
	}
}