package generator import "testing" func TestValueCastSlicePointer (test *testing.T) { testString (test, `%Index = type i64 define void @main() { 0: %1 = alloca { ptr, %Index } %2 = alloca ptr %3 = getelementptr { ptr, %Index }, ptr %1, i32 0, i32 0 %4 = load ptr, ptr %3 store ptr %4, ptr %2 ret void } `, ` [main] = { slice: *:Byte pointer: *Byte = [~*Byte slice] } `) } func TestValueCastIntegerIneffectual (test *testing.T) { testString (test, `%A = type i64 define void @main() { 0: %1 = alloca i64 store i64 5, ptr %1 %2 = alloca %A %3 = load i64, ptr %1 store i64 %3, ptr %2 ret void } `, ` A: Int [main] = { x:Int = 5 y:A = [~A x] } `) } func TestValueCastStringIneffectual (test *testing.T) { testString (test, `%Index = type i64 %String = type { ptr, %Index } define void @main() { 0: %1 = alloca { ptr, %Index } %2 = alloca %String %3 = load { ptr, %Index }, ptr %1 store { ptr, %Index } %3, ptr %2 ret void } `, ` [main] = { y:*:Byte x:String = [~String y] } `) } func TestBitCastStringIneffectual (test *testing.T) { testString (test, `%Index = type i64 %String = type { ptr, %Index } define void @main() { 0: %1 = alloca { ptr, %Index } %2 = alloca %String %3 = load { ptr, %Index }, ptr %1 store { ptr, %Index } %3, ptr %2 ret void } `, ` [main] = { y:*:Byte x:String = [~~String y] } `) }