blob: 7159f0ed33a375960c782f69940446d4c7ae5278 [file] [log] [blame]
// run
// Code generated by gen/constFoldGen.go. DO NOT EDIT.
package test
import "testing"
func TestConstFolduint64add(t *testing.T) {
var x, y, r uint64
x = 0
y = 0
r = x + y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "+", r)
}
y = 1
r = x + y
if r != 1 {
t.Errorf("0 %s 1 = %d, want 1", "+", r)
}
y = 4294967296
r = x + y
if r != 4294967296 {
t.Errorf("0 %s 4294967296 = %d, want 4294967296", "+", r)
}
y = 18446744073709551615
r = x + y
if r != 18446744073709551615 {
t.Errorf("0 %s 18446744073709551615 = %d, want 18446744073709551615", "+", r)
}
x = 1
y = 0
r = x + y
if r != 1 {
t.Errorf("1 %s 0 = %d, want 1", "+", r)
}
y = 1
r = x + y
if r != 2 {
t.Errorf("1 %s 1 = %d, want 2", "+", r)
}
y = 4294967296
r = x + y
if r != 4294967297 {
t.Errorf("1 %s 4294967296 = %d, want 4294967297", "+", r)
}
y = 18446744073709551615
r = x + y
if r != 0 {
t.Errorf("1 %s 18446744073709551615 = %d, want 0", "+", r)
}
x = 4294967296
y = 0
r = x + y
if r != 4294967296 {
t.Errorf("4294967296 %s 0 = %d, want 4294967296", "+", r)
}
y = 1
r = x + y
if r != 4294967297 {
t.Errorf("4294967296 %s 1 = %d, want 4294967297", "+", r)
}
y = 4294967296
r = x + y
if r != 8589934592 {
t.Errorf("4294967296 %s 4294967296 = %d, want 8589934592", "+", r)
}
y = 18446744073709551615
r = x + y
if r != 4294967295 {
t.Errorf("4294967296 %s 18446744073709551615 = %d, want 4294967295", "+", r)
}
x = 18446744073709551615
y = 0
r = x + y
if r != 18446744073709551615 {
t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "+", r)
}
y = 1
r = x + y
if r != 0 {
t.Errorf("18446744073709551615 %s 1 = %d, want 0", "+", r)
}
y = 4294967296
r = x + y
if r != 4294967295 {
t.Errorf("18446744073709551615 %s 4294967296 = %d, want 4294967295", "+", r)
}
y = 18446744073709551615
r = x + y
if r != 18446744073709551614 {
t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 18446744073709551614", "+", r)
}
}
func TestConstFolduint64sub(t *testing.T) {
var x, y, r uint64
x = 0
y = 0
r = x - y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "-", r)
}
y = 1
r = x - y
if r != 18446744073709551615 {
t.Errorf("0 %s 1 = %d, want 18446744073709551615", "-", r)
}
y = 4294967296
r = x - y
if r != 18446744069414584320 {
t.Errorf("0 %s 4294967296 = %d, want 18446744069414584320", "-", r)
}
y = 18446744073709551615
r = x - y
if r != 1 {
t.Errorf("0 %s 18446744073709551615 = %d, want 1", "-", r)
}
x = 1
y = 0
r = x - y
if r != 1 {
t.Errorf("1 %s 0 = %d, want 1", "-", r)
}
y = 1
r = x - y
if r != 0 {
t.Errorf("1 %s 1 = %d, want 0", "-", r)
}
y = 4294967296
r = x - y
if r != 18446744069414584321 {
t.Errorf("1 %s 4294967296 = %d, want 18446744069414584321", "-", r)
}
y = 18446744073709551615
r = x - y
if r != 2 {
t.Errorf("1 %s 18446744073709551615 = %d, want 2", "-", r)
}
x = 4294967296
y = 0
r = x - y
if r != 4294967296 {
t.Errorf("4294967296 %s 0 = %d, want 4294967296", "-", r)
}
y = 1
r = x - y
if r != 4294967295 {
t.Errorf("4294967296 %s 1 = %d, want 4294967295", "-", r)
}
y = 4294967296
r = x - y
if r != 0 {
t.Errorf("4294967296 %s 4294967296 = %d, want 0", "-", r)
}
y = 18446744073709551615
r = x - y
if r != 4294967297 {
t.Errorf("4294967296 %s 18446744073709551615 = %d, want 4294967297", "-", r)
}
x = 18446744073709551615
y = 0
r = x - y
if r != 18446744073709551615 {
t.Errorf("18446744073709551615 %s 0 = %d, want 18446744073709551615", "-", r)
}
y = 1
r = x - y
if r != 18446744073709551614 {
t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551614", "-", r)
}
y = 4294967296
r = x - y
if r != 18446744069414584319 {
t.Errorf("18446744073709551615 %s 4294967296 = %d, want 18446744069414584319", "-", r)
}
y = 18446744073709551615
r = x - y
if r != 0 {
t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 0", "-", r)
}
}
func TestConstFolduint64div(t *testing.T) {
var x, y, r uint64
x = 0
y = 1
r = x / y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "/", r)
}
y = 4294967296
r = x / y
if r != 0 {
t.Errorf("0 %s 4294967296 = %d, want 0", "/", r)
}
y = 18446744073709551615
r = x / y
if r != 0 {
t.Errorf("0 %s 18446744073709551615 = %d, want 0", "/", r)
}
x = 1
y = 1
r = x / y
if r != 1 {
t.Errorf("1 %s 1 = %d, want 1", "/", r)
}
y = 4294967296
r = x / y
if r != 0 {
t.Errorf("1 %s 4294967296 = %d, want 0", "/", r)
}
y = 18446744073709551615
r = x / y
if r != 0 {
t.Errorf("1 %s 18446744073709551615 = %d, want 0", "/", r)
}
x = 4294967296
y = 1
r = x / y
if r != 4294967296 {
t.Errorf("4294967296 %s 1 = %d, want 4294967296", "/", r)
}
y = 4294967296
r = x / y
if r != 1 {
t.Errorf("4294967296 %s 4294967296 = %d, want 1", "/", r)
}
y = 18446744073709551615
r = x / y
if r != 0 {
t.Errorf("4294967296 %s 18446744073709551615 = %d, want 0", "/", r)
}
x = 18446744073709551615
y = 1
r = x / y
if r != 18446744073709551615 {
t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551615", "/", r)
}
y = 4294967296
r = x / y
if r != 4294967295 {
t.Errorf("18446744073709551615 %s 4294967296 = %d, want 4294967295", "/", r)
}
y = 18446744073709551615
r = x / y
if r != 1 {
t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 1", "/", r)
}
}
func TestConstFolduint64mul(t *testing.T) {
var x, y, r uint64
x = 0
y = 0
r = x * y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "*", r)
}
y = 4294967296
r = x * y
if r != 0 {
t.Errorf("0 %s 4294967296 = %d, want 0", "*", r)
}
y = 18446744073709551615
r = x * y
if r != 0 {
t.Errorf("0 %s 18446744073709551615 = %d, want 0", "*", r)
}
x = 1
y = 0
r = x * y
if r != 0 {
t.Errorf("1 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 1 {
t.Errorf("1 %s 1 = %d, want 1", "*", r)
}
y = 4294967296
r = x * y
if r != 4294967296 {
t.Errorf("1 %s 4294967296 = %d, want 4294967296", "*", r)
}
y = 18446744073709551615
r = x * y
if r != 18446744073709551615 {
t.Errorf("1 %s 18446744073709551615 = %d, want 18446744073709551615", "*", r)
}
x = 4294967296
y = 0
r = x * y
if r != 0 {
t.Errorf("4294967296 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 4294967296 {
t.Errorf("4294967296 %s 1 = %d, want 4294967296", "*", r)
}
y = 4294967296
r = x * y
if r != 0 {
t.Errorf("4294967296 %s 4294967296 = %d, want 0", "*", r)
}
y = 18446744073709551615
r = x * y
if r != 18446744069414584320 {
t.Errorf("4294967296 %s 18446744073709551615 = %d, want 18446744069414584320", "*", r)
}
x = 18446744073709551615
y = 0
r = x * y
if r != 0 {
t.Errorf("18446744073709551615 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 18446744073709551615 {
t.Errorf("18446744073709551615 %s 1 = %d, want 18446744073709551615", "*", r)
}
y = 4294967296
r = x * y
if r != 18446744069414584320 {
t.Errorf("18446744073709551615 %s 4294967296 = %d, want 18446744069414584320", "*", r)
}
y = 18446744073709551615
r = x * y
if r != 1 {
t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 1", "*", r)
}
}
func TestConstFolduint64mod(t *testing.T) {
var x, y, r uint64
x = 0
y = 1
r = x % y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 0 {
t.Errorf("0 %s 4294967296 = %d, want 0", "%", r)
}
y = 18446744073709551615
r = x % y
if r != 0 {
t.Errorf("0 %s 18446744073709551615 = %d, want 0", "%", r)
}
x = 1
y = 1
r = x % y
if r != 0 {
t.Errorf("1 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 1 {
t.Errorf("1 %s 4294967296 = %d, want 1", "%", r)
}
y = 18446744073709551615
r = x % y
if r != 1 {
t.Errorf("1 %s 18446744073709551615 = %d, want 1", "%", r)
}
x = 4294967296
y = 1
r = x % y
if r != 0 {
t.Errorf("4294967296 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 0 {
t.Errorf("4294967296 %s 4294967296 = %d, want 0", "%", r)
}
y = 18446744073709551615
r = x % y
if r != 4294967296 {
t.Errorf("4294967296 %s 18446744073709551615 = %d, want 4294967296", "%", r)
}
x = 18446744073709551615
y = 1
r = x % y
if r != 0 {
t.Errorf("18446744073709551615 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 4294967295 {
t.Errorf("18446744073709551615 %s 4294967296 = %d, want 4294967295", "%", r)
}
y = 18446744073709551615
r = x % y
if r != 0 {
t.Errorf("18446744073709551615 %s 18446744073709551615 = %d, want 0", "%", r)
}
}
func TestConstFoldint64add(t *testing.T) {
var x, y, r int64
x = -9223372036854775808
y = -9223372036854775808
r = x + y
if r != 0 {
t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "+", r)
}
y = -9223372036854775807
r = x + y
if r != 1 {
t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want 1", "+", r)
}
y = -4294967296
r = x + y
if r != 9223372032559808512 {
t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 9223372032559808512", "+", r)
}
y = -1
r = x + y
if r != 9223372036854775807 {
t.Errorf("-9223372036854775808 %s -1 = %d, want 9223372036854775807", "+", r)
}
y = 0
r = x + y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "+", r)
}
y = 1
r = x + y
if r != -9223372036854775807 {
t.Errorf("-9223372036854775808 %s 1 = %d, want -9223372036854775807", "+", r)
}
y = 4294967296
r = x + y
if r != -9223372032559808512 {
t.Errorf("-9223372036854775808 %s 4294967296 = %d, want -9223372032559808512", "+", r)
}
y = 9223372036854775806
r = x + y
if r != -2 {
t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want -2", "+", r)
}
y = 9223372036854775807
r = x + y
if r != -1 {
t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -1", "+", r)
}
x = -9223372036854775807
y = -9223372036854775808
r = x + y
if r != 1 {
t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want 1", "+", r)
}
y = -9223372036854775807
r = x + y
if r != 2 {
t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 2", "+", r)
}
y = -4294967296
r = x + y
if r != 9223372032559808513 {
t.Errorf("-9223372036854775807 %s -4294967296 = %d, want 9223372032559808513", "+", r)
}
y = -1
r = x + y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775807 %s -1 = %d, want -9223372036854775808", "+", r)
}
y = 0
r = x + y
if r != -9223372036854775807 {
t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "+", r)
}
y = 1
r = x + y
if r != -9223372036854775806 {
t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775806", "+", r)
}
y = 4294967296
r = x + y
if r != -9223372032559808511 {
t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -9223372032559808511", "+", r)
}
y = 9223372036854775806
r = x + y
if r != -1 {
t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want -1", "+", r)
}
y = 9223372036854775807
r = x + y
if r != 0 {
t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want 0", "+", r)
}
x = -4294967296
y = -9223372036854775808
r = x + y
if r != 9223372032559808512 {
t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 9223372032559808512", "+", r)
}
y = -9223372036854775807
r = x + y
if r != 9223372032559808513 {
t.Errorf("-4294967296 %s -9223372036854775807 = %d, want 9223372032559808513", "+", r)
}
y = -4294967296
r = x + y
if r != -8589934592 {
t.Errorf("-4294967296 %s -4294967296 = %d, want -8589934592", "+", r)
}
y = -1
r = x + y
if r != -4294967297 {
t.Errorf("-4294967296 %s -1 = %d, want -4294967297", "+", r)
}
y = 0
r = x + y
if r != -4294967296 {
t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "+", r)
}
y = 1
r = x + y
if r != -4294967295 {
t.Errorf("-4294967296 %s 1 = %d, want -4294967295", "+", r)
}
y = 4294967296
r = x + y
if r != 0 {
t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "+", r)
}
y = 9223372036854775806
r = x + y
if r != 9223372032559808510 {
t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 9223372032559808510", "+", r)
}
y = 9223372036854775807
r = x + y
if r != 9223372032559808511 {
t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 9223372032559808511", "+", r)
}
x = -1
y = -9223372036854775808
r = x + y
if r != 9223372036854775807 {
t.Errorf("-1 %s -9223372036854775808 = %d, want 9223372036854775807", "+", r)
}
y = -9223372036854775807
r = x + y
if r != -9223372036854775808 {
t.Errorf("-1 %s -9223372036854775807 = %d, want -9223372036854775808", "+", r)
}
y = -4294967296
r = x + y
if r != -4294967297 {
t.Errorf("-1 %s -4294967296 = %d, want -4294967297", "+", r)
}
y = -1
r = x + y
if r != -2 {
t.Errorf("-1 %s -1 = %d, want -2", "+", r)
}
y = 0
r = x + y
if r != -1 {
t.Errorf("-1 %s 0 = %d, want -1", "+", r)
}
y = 1
r = x + y
if r != 0 {
t.Errorf("-1 %s 1 = %d, want 0", "+", r)
}
y = 4294967296
r = x + y
if r != 4294967295 {
t.Errorf("-1 %s 4294967296 = %d, want 4294967295", "+", r)
}
y = 9223372036854775806
r = x + y
if r != 9223372036854775805 {
t.Errorf("-1 %s 9223372036854775806 = %d, want 9223372036854775805", "+", r)
}
y = 9223372036854775807
r = x + y
if r != 9223372036854775806 {
t.Errorf("-1 %s 9223372036854775807 = %d, want 9223372036854775806", "+", r)
}
x = 0
y = -9223372036854775808
r = x + y
if r != -9223372036854775808 {
t.Errorf("0 %s -9223372036854775808 = %d, want -9223372036854775808", "+", r)
}
y = -9223372036854775807
r = x + y
if r != -9223372036854775807 {
t.Errorf("0 %s -9223372036854775807 = %d, want -9223372036854775807", "+", r)
}
y = -4294967296
r = x + y
if r != -4294967296 {
t.Errorf("0 %s -4294967296 = %d, want -4294967296", "+", r)
}
y = -1
r = x + y
if r != -1 {
t.Errorf("0 %s -1 = %d, want -1", "+", r)
}
y = 0
r = x + y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "+", r)
}
y = 1
r = x + y
if r != 1 {
t.Errorf("0 %s 1 = %d, want 1", "+", r)
}
y = 4294967296
r = x + y
if r != 4294967296 {
t.Errorf("0 %s 4294967296 = %d, want 4294967296", "+", r)
}
y = 9223372036854775806
r = x + y
if r != 9223372036854775806 {
t.Errorf("0 %s 9223372036854775806 = %d, want 9223372036854775806", "+", r)
}
y = 9223372036854775807
r = x + y
if r != 9223372036854775807 {
t.Errorf("0 %s 9223372036854775807 = %d, want 9223372036854775807", "+", r)
}
x = 1
y = -9223372036854775808
r = x + y
if r != -9223372036854775807 {
t.Errorf("1 %s -9223372036854775808 = %d, want -9223372036854775807", "+", r)
}
y = -9223372036854775807
r = x + y
if r != -9223372036854775806 {
t.Errorf("1 %s -9223372036854775807 = %d, want -9223372036854775806", "+", r)
}
y = -4294967296
r = x + y
if r != -4294967295 {
t.Errorf("1 %s -4294967296 = %d, want -4294967295", "+", r)
}
y = -1
r = x + y
if r != 0 {
t.Errorf("1 %s -1 = %d, want 0", "+", r)
}
y = 0
r = x + y
if r != 1 {
t.Errorf("1 %s 0 = %d, want 1", "+", r)
}
y = 1
r = x + y
if r != 2 {
t.Errorf("1 %s 1 = %d, want 2", "+", r)
}
y = 4294967296
r = x + y
if r != 4294967297 {
t.Errorf("1 %s 4294967296 = %d, want 4294967297", "+", r)
}
y = 9223372036854775806
r = x + y
if r != 9223372036854775807 {
t.Errorf("1 %s 9223372036854775806 = %d, want 9223372036854775807", "+", r)
}
y = 9223372036854775807
r = x + y
if r != -9223372036854775808 {
t.Errorf("1 %s 9223372036854775807 = %d, want -9223372036854775808", "+", r)
}
x = 4294967296
y = -9223372036854775808
r = x + y
if r != -9223372032559808512 {
t.Errorf("4294967296 %s -9223372036854775808 = %d, want -9223372032559808512", "+", r)
}
y = -9223372036854775807
r = x + y
if r != -9223372032559808511 {
t.Errorf("4294967296 %s -9223372036854775807 = %d, want -9223372032559808511", "+", r)
}
y = -4294967296
r = x + y
if r != 0 {
t.Errorf("4294967296 %s -4294967296 = %d, want 0", "+", r)
}
y = -1
r = x + y
if r != 4294967295 {
t.Errorf("4294967296 %s -1 = %d, want 4294967295", "+", r)
}
y = 0
r = x + y
if r != 4294967296 {
t.Errorf("4294967296 %s 0 = %d, want 4294967296", "+", r)
}
y = 1
r = x + y
if r != 4294967297 {
t.Errorf("4294967296 %s 1 = %d, want 4294967297", "+", r)
}
y = 4294967296
r = x + y
if r != 8589934592 {
t.Errorf("4294967296 %s 4294967296 = %d, want 8589934592", "+", r)
}
y = 9223372036854775806
r = x + y
if r != -9223372032559808514 {
t.Errorf("4294967296 %s 9223372036854775806 = %d, want -9223372032559808514", "+", r)
}
y = 9223372036854775807
r = x + y
if r != -9223372032559808513 {
t.Errorf("4294967296 %s 9223372036854775807 = %d, want -9223372032559808513", "+", r)
}
x = 9223372036854775806
y = -9223372036854775808
r = x + y
if r != -2 {
t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want -2", "+", r)
}
y = -9223372036854775807
r = x + y
if r != -1 {
t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want -1", "+", r)
}
y = -4294967296
r = x + y
if r != 9223372032559808510 {
t.Errorf("9223372036854775806 %s -4294967296 = %d, want 9223372032559808510", "+", r)
}
y = -1
r = x + y
if r != 9223372036854775805 {
t.Errorf("9223372036854775806 %s -1 = %d, want 9223372036854775805", "+", r)
}
y = 0
r = x + y
if r != 9223372036854775806 {
t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "+", r)
}
y = 1
r = x + y
if r != 9223372036854775807 {
t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775807", "+", r)
}
y = 4294967296
r = x + y
if r != -9223372032559808514 {
t.Errorf("9223372036854775806 %s 4294967296 = %d, want -9223372032559808514", "+", r)
}
y = 9223372036854775806
r = x + y
if r != -4 {
t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want -4", "+", r)
}
y = 9223372036854775807
r = x + y
if r != -3 {
t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want -3", "+", r)
}
x = 9223372036854775807
y = -9223372036854775808
r = x + y
if r != -1 {
t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want -1", "+", r)
}
y = -9223372036854775807
r = x + y
if r != 0 {
t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want 0", "+", r)
}
y = -4294967296
r = x + y
if r != 9223372032559808511 {
t.Errorf("9223372036854775807 %s -4294967296 = %d, want 9223372032559808511", "+", r)
}
y = -1
r = x + y
if r != 9223372036854775806 {
t.Errorf("9223372036854775807 %s -1 = %d, want 9223372036854775806", "+", r)
}
y = 0
r = x + y
if r != 9223372036854775807 {
t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "+", r)
}
y = 1
r = x + y
if r != -9223372036854775808 {
t.Errorf("9223372036854775807 %s 1 = %d, want -9223372036854775808", "+", r)
}
y = 4294967296
r = x + y
if r != -9223372032559808513 {
t.Errorf("9223372036854775807 %s 4294967296 = %d, want -9223372032559808513", "+", r)
}
y = 9223372036854775806
r = x + y
if r != -3 {
t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want -3", "+", r)
}
y = 9223372036854775807
r = x + y
if r != -2 {
t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want -2", "+", r)
}
}
func TestConstFoldint64sub(t *testing.T) {
var x, y, r int64
x = -9223372036854775808
y = -9223372036854775808
r = x - y
if r != 0 {
t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "-", r)
}
y = -9223372036854775807
r = x - y
if r != -1 {
t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want -1", "-", r)
}
y = -4294967296
r = x - y
if r != -9223372032559808512 {
t.Errorf("-9223372036854775808 %s -4294967296 = %d, want -9223372032559808512", "-", r)
}
y = -1
r = x - y
if r != -9223372036854775807 {
t.Errorf("-9223372036854775808 %s -1 = %d, want -9223372036854775807", "-", r)
}
y = 0
r = x - y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775808 %s 0 = %d, want -9223372036854775808", "-", r)
}
y = 1
r = x - y
if r != 9223372036854775807 {
t.Errorf("-9223372036854775808 %s 1 = %d, want 9223372036854775807", "-", r)
}
y = 4294967296
r = x - y
if r != 9223372032559808512 {
t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 9223372032559808512", "-", r)
}
y = 9223372036854775806
r = x - y
if r != 2 {
t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want 2", "-", r)
}
y = 9223372036854775807
r = x - y
if r != 1 {
t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want 1", "-", r)
}
x = -9223372036854775807
y = -9223372036854775808
r = x - y
if r != 1 {
t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want 1", "-", r)
}
y = -9223372036854775807
r = x - y
if r != 0 {
t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 0", "-", r)
}
y = -4294967296
r = x - y
if r != -9223372032559808511 {
t.Errorf("-9223372036854775807 %s -4294967296 = %d, want -9223372032559808511", "-", r)
}
y = -1
r = x - y
if r != -9223372036854775806 {
t.Errorf("-9223372036854775807 %s -1 = %d, want -9223372036854775806", "-", r)
}
y = 0
r = x - y
if r != -9223372036854775807 {
t.Errorf("-9223372036854775807 %s 0 = %d, want -9223372036854775807", "-", r)
}
y = 1
r = x - y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775808", "-", r)
}
y = 4294967296
r = x - y
if r != 9223372032559808513 {
t.Errorf("-9223372036854775807 %s 4294967296 = %d, want 9223372032559808513", "-", r)
}
y = 9223372036854775806
r = x - y
if r != 3 {
t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want 3", "-", r)
}
y = 9223372036854775807
r = x - y
if r != 2 {
t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want 2", "-", r)
}
x = -4294967296
y = -9223372036854775808
r = x - y
if r != 9223372032559808512 {
t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 9223372032559808512", "-", r)
}
y = -9223372036854775807
r = x - y
if r != 9223372032559808511 {
t.Errorf("-4294967296 %s -9223372036854775807 = %d, want 9223372032559808511", "-", r)
}
y = -4294967296
r = x - y
if r != 0 {
t.Errorf("-4294967296 %s -4294967296 = %d, want 0", "-", r)
}
y = -1
r = x - y
if r != -4294967295 {
t.Errorf("-4294967296 %s -1 = %d, want -4294967295", "-", r)
}
y = 0
r = x - y
if r != -4294967296 {
t.Errorf("-4294967296 %s 0 = %d, want -4294967296", "-", r)
}
y = 1
r = x - y
if r != -4294967297 {
t.Errorf("-4294967296 %s 1 = %d, want -4294967297", "-", r)
}
y = 4294967296
r = x - y
if r != -8589934592 {
t.Errorf("-4294967296 %s 4294967296 = %d, want -8589934592", "-", r)
}
y = 9223372036854775806
r = x - y
if r != 9223372032559808514 {
t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 9223372032559808514", "-", r)
}
y = 9223372036854775807
r = x - y
if r != 9223372032559808513 {
t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 9223372032559808513", "-", r)
}
x = -1
y = -9223372036854775808
r = x - y
if r != 9223372036854775807 {
t.Errorf("-1 %s -9223372036854775808 = %d, want 9223372036854775807", "-", r)
}
y = -9223372036854775807
r = x - y
if r != 9223372036854775806 {
t.Errorf("-1 %s -9223372036854775807 = %d, want 9223372036854775806", "-", r)
}
y = -4294967296
r = x - y
if r != 4294967295 {
t.Errorf("-1 %s -4294967296 = %d, want 4294967295", "-", r)
}
y = -1
r = x - y
if r != 0 {
t.Errorf("-1 %s -1 = %d, want 0", "-", r)
}
y = 0
r = x - y
if r != -1 {
t.Errorf("-1 %s 0 = %d, want -1", "-", r)
}
y = 1
r = x - y
if r != -2 {
t.Errorf("-1 %s 1 = %d, want -2", "-", r)
}
y = 4294967296
r = x - y
if r != -4294967297 {
t.Errorf("-1 %s 4294967296 = %d, want -4294967297", "-", r)
}
y = 9223372036854775806
r = x - y
if r != -9223372036854775807 {
t.Errorf("-1 %s 9223372036854775806 = %d, want -9223372036854775807", "-", r)
}
y = 9223372036854775807
r = x - y
if r != -9223372036854775808 {
t.Errorf("-1 %s 9223372036854775807 = %d, want -9223372036854775808", "-", r)
}
x = 0
y = -9223372036854775808
r = x - y
if r != -9223372036854775808 {
t.Errorf("0 %s -9223372036854775808 = %d, want -9223372036854775808", "-", r)
}
y = -9223372036854775807
r = x - y
if r != 9223372036854775807 {
t.Errorf("0 %s -9223372036854775807 = %d, want 9223372036854775807", "-", r)
}
y = -4294967296
r = x - y
if r != 4294967296 {
t.Errorf("0 %s -4294967296 = %d, want 4294967296", "-", r)
}
y = -1
r = x - y
if r != 1 {
t.Errorf("0 %s -1 = %d, want 1", "-", r)
}
y = 0
r = x - y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "-", r)
}
y = 1
r = x - y
if r != -1 {
t.Errorf("0 %s 1 = %d, want -1", "-", r)
}
y = 4294967296
r = x - y
if r != -4294967296 {
t.Errorf("0 %s 4294967296 = %d, want -4294967296", "-", r)
}
y = 9223372036854775806
r = x - y
if r != -9223372036854775806 {
t.Errorf("0 %s 9223372036854775806 = %d, want -9223372036854775806", "-", r)
}
y = 9223372036854775807
r = x - y
if r != -9223372036854775807 {
t.Errorf("0 %s 9223372036854775807 = %d, want -9223372036854775807", "-", r)
}
x = 1
y = -9223372036854775808
r = x - y
if r != -9223372036854775807 {
t.Errorf("1 %s -9223372036854775808 = %d, want -9223372036854775807", "-", r)
}
y = -9223372036854775807
r = x - y
if r != -9223372036854775808 {
t.Errorf("1 %s -9223372036854775807 = %d, want -9223372036854775808", "-", r)
}
y = -4294967296
r = x - y
if r != 4294967297 {
t.Errorf("1 %s -4294967296 = %d, want 4294967297", "-", r)
}
y = -1
r = x - y
if r != 2 {
t.Errorf("1 %s -1 = %d, want 2", "-", r)
}
y = 0
r = x - y
if r != 1 {
t.Errorf("1 %s 0 = %d, want 1", "-", r)
}
y = 1
r = x - y
if r != 0 {
t.Errorf("1 %s 1 = %d, want 0", "-", r)
}
y = 4294967296
r = x - y
if r != -4294967295 {
t.Errorf("1 %s 4294967296 = %d, want -4294967295", "-", r)
}
y = 9223372036854775806
r = x - y
if r != -9223372036854775805 {
t.Errorf("1 %s 9223372036854775806 = %d, want -9223372036854775805", "-", r)
}
y = 9223372036854775807
r = x - y
if r != -9223372036854775806 {
t.Errorf("1 %s 9223372036854775807 = %d, want -9223372036854775806", "-", r)
}
x = 4294967296
y = -9223372036854775808
r = x - y
if r != -9223372032559808512 {
t.Errorf("4294967296 %s -9223372036854775808 = %d, want -9223372032559808512", "-", r)
}
y = -9223372036854775807
r = x - y
if r != -9223372032559808513 {
t.Errorf("4294967296 %s -9223372036854775807 = %d, want -9223372032559808513", "-", r)
}
y = -4294967296
r = x - y
if r != 8589934592 {
t.Errorf("4294967296 %s -4294967296 = %d, want 8589934592", "-", r)
}
y = -1
r = x - y
if r != 4294967297 {
t.Errorf("4294967296 %s -1 = %d, want 4294967297", "-", r)
}
y = 0
r = x - y
if r != 4294967296 {
t.Errorf("4294967296 %s 0 = %d, want 4294967296", "-", r)
}
y = 1
r = x - y
if r != 4294967295 {
t.Errorf("4294967296 %s 1 = %d, want 4294967295", "-", r)
}
y = 4294967296
r = x - y
if r != 0 {
t.Errorf("4294967296 %s 4294967296 = %d, want 0", "-", r)
}
y = 9223372036854775806
r = x - y
if r != -9223372032559808510 {
t.Errorf("4294967296 %s 9223372036854775806 = %d, want -9223372032559808510", "-", r)
}
y = 9223372036854775807
r = x - y
if r != -9223372032559808511 {
t.Errorf("4294967296 %s 9223372036854775807 = %d, want -9223372032559808511", "-", r)
}
x = 9223372036854775806
y = -9223372036854775808
r = x - y
if r != -2 {
t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want -2", "-", r)
}
y = -9223372036854775807
r = x - y
if r != -3 {
t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want -3", "-", r)
}
y = -4294967296
r = x - y
if r != -9223372032559808514 {
t.Errorf("9223372036854775806 %s -4294967296 = %d, want -9223372032559808514", "-", r)
}
y = -1
r = x - y
if r != 9223372036854775807 {
t.Errorf("9223372036854775806 %s -1 = %d, want 9223372036854775807", "-", r)
}
y = 0
r = x - y
if r != 9223372036854775806 {
t.Errorf("9223372036854775806 %s 0 = %d, want 9223372036854775806", "-", r)
}
y = 1
r = x - y
if r != 9223372036854775805 {
t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775805", "-", r)
}
y = 4294967296
r = x - y
if r != 9223372032559808510 {
t.Errorf("9223372036854775806 %s 4294967296 = %d, want 9223372032559808510", "-", r)
}
y = 9223372036854775806
r = x - y
if r != 0 {
t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 0", "-", r)
}
y = 9223372036854775807
r = x - y
if r != -1 {
t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want -1", "-", r)
}
x = 9223372036854775807
y = -9223372036854775808
r = x - y
if r != -1 {
t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want -1", "-", r)
}
y = -9223372036854775807
r = x - y
if r != -2 {
t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want -2", "-", r)
}
y = -4294967296
r = x - y
if r != -9223372032559808513 {
t.Errorf("9223372036854775807 %s -4294967296 = %d, want -9223372032559808513", "-", r)
}
y = -1
r = x - y
if r != -9223372036854775808 {
t.Errorf("9223372036854775807 %s -1 = %d, want -9223372036854775808", "-", r)
}
y = 0
r = x - y
if r != 9223372036854775807 {
t.Errorf("9223372036854775807 %s 0 = %d, want 9223372036854775807", "-", r)
}
y = 1
r = x - y
if r != 9223372036854775806 {
t.Errorf("9223372036854775807 %s 1 = %d, want 9223372036854775806", "-", r)
}
y = 4294967296
r = x - y
if r != 9223372032559808511 {
t.Errorf("9223372036854775807 %s 4294967296 = %d, want 9223372032559808511", "-", r)
}
y = 9223372036854775806
r = x - y
if r != 1 {
t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want 1", "-", r)
}
y = 9223372036854775807
r = x - y
if r != 0 {
t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 0", "-", r)
}
}
func TestConstFoldint64div(t *testing.T) {
var x, y, r int64
x = -9223372036854775808
y = -9223372036854775808
r = x / y
if r != 1 {
t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 1", "/", r)
}
y = -9223372036854775807
r = x / y
if r != 1 {
t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want 1", "/", r)
}
y = -4294967296
r = x / y
if r != 2147483648 {
t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 2147483648", "/", r)
}
y = -1
r = x / y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775808 %s -1 = %d, want -9223372036854775808", "/", r)
}
y = 1
r = x / y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775808 %s 1 = %d, want -9223372036854775808", "/", r)
}
y = 4294967296
r = x / y
if r != -2147483648 {
t.Errorf("-9223372036854775808 %s 4294967296 = %d, want -2147483648", "/", r)
}
y = 9223372036854775806
r = x / y
if r != -1 {
t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want -1", "/", r)
}
y = 9223372036854775807
r = x / y
if r != -1 {
t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -1", "/", r)
}
x = -9223372036854775807
y = -9223372036854775808
r = x / y
if r != 0 {
t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want 0", "/", r)
}
y = -9223372036854775807
r = x / y
if r != 1 {
t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 1", "/", r)
}
y = -4294967296
r = x / y
if r != 2147483647 {
t.Errorf("-9223372036854775807 %s -4294967296 = %d, want 2147483647", "/", r)
}
y = -1
r = x / y
if r != 9223372036854775807 {
t.Errorf("-9223372036854775807 %s -1 = %d, want 9223372036854775807", "/", r)
}
y = 1
r = x / y
if r != -9223372036854775807 {
t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775807", "/", r)
}
y = 4294967296
r = x / y
if r != -2147483647 {
t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -2147483647", "/", r)
}
y = 9223372036854775806
r = x / y
if r != -1 {
t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want -1", "/", r)
}
y = 9223372036854775807
r = x / y
if r != -1 {
t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want -1", "/", r)
}
x = -4294967296
y = -9223372036854775808
r = x / y
if r != 0 {
t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 0", "/", r)
}
y = -9223372036854775807
r = x / y
if r != 0 {
t.Errorf("-4294967296 %s -9223372036854775807 = %d, want 0", "/", r)
}
y = -4294967296
r = x / y
if r != 1 {
t.Errorf("-4294967296 %s -4294967296 = %d, want 1", "/", r)
}
y = -1
r = x / y
if r != 4294967296 {
t.Errorf("-4294967296 %s -1 = %d, want 4294967296", "/", r)
}
y = 1
r = x / y
if r != -4294967296 {
t.Errorf("-4294967296 %s 1 = %d, want -4294967296", "/", r)
}
y = 4294967296
r = x / y
if r != -1 {
t.Errorf("-4294967296 %s 4294967296 = %d, want -1", "/", r)
}
y = 9223372036854775806
r = x / y
if r != 0 {
t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 0", "/", r)
}
y = 9223372036854775807
r = x / y
if r != 0 {
t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 0", "/", r)
}
x = -1
y = -9223372036854775808
r = x / y
if r != 0 {
t.Errorf("-1 %s -9223372036854775808 = %d, want 0", "/", r)
}
y = -9223372036854775807
r = x / y
if r != 0 {
t.Errorf("-1 %s -9223372036854775807 = %d, want 0", "/", r)
}
y = -4294967296
r = x / y
if r != 0 {
t.Errorf("-1 %s -4294967296 = %d, want 0", "/", r)
}
y = -1
r = x / y
if r != 1 {
t.Errorf("-1 %s -1 = %d, want 1", "/", r)
}
y = 1
r = x / y
if r != -1 {
t.Errorf("-1 %s 1 = %d, want -1", "/", r)
}
y = 4294967296
r = x / y
if r != 0 {
t.Errorf("-1 %s 4294967296 = %d, want 0", "/", r)
}
y = 9223372036854775806
r = x / y
if r != 0 {
t.Errorf("-1 %s 9223372036854775806 = %d, want 0", "/", r)
}
y = 9223372036854775807
r = x / y
if r != 0 {
t.Errorf("-1 %s 9223372036854775807 = %d, want 0", "/", r)
}
x = 0
y = -9223372036854775808
r = x / y
if r != 0 {
t.Errorf("0 %s -9223372036854775808 = %d, want 0", "/", r)
}
y = -9223372036854775807
r = x / y
if r != 0 {
t.Errorf("0 %s -9223372036854775807 = %d, want 0", "/", r)
}
y = -4294967296
r = x / y
if r != 0 {
t.Errorf("0 %s -4294967296 = %d, want 0", "/", r)
}
y = -1
r = x / y
if r != 0 {
t.Errorf("0 %s -1 = %d, want 0", "/", r)
}
y = 1
r = x / y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "/", r)
}
y = 4294967296
r = x / y
if r != 0 {
t.Errorf("0 %s 4294967296 = %d, want 0", "/", r)
}
y = 9223372036854775806
r = x / y
if r != 0 {
t.Errorf("0 %s 9223372036854775806 = %d, want 0", "/", r)
}
y = 9223372036854775807
r = x / y
if r != 0 {
t.Errorf("0 %s 9223372036854775807 = %d, want 0", "/", r)
}
x = 1
y = -9223372036854775808
r = x / y
if r != 0 {
t.Errorf("1 %s -9223372036854775808 = %d, want 0", "/", r)
}
y = -9223372036854775807
r = x / y
if r != 0 {
t.Errorf("1 %s -9223372036854775807 = %d, want 0", "/", r)
}
y = -4294967296
r = x / y
if r != 0 {
t.Errorf("1 %s -4294967296 = %d, want 0", "/", r)
}
y = -1
r = x / y
if r != -1 {
t.Errorf("1 %s -1 = %d, want -1", "/", r)
}
y = 1
r = x / y
if r != 1 {
t.Errorf("1 %s 1 = %d, want 1", "/", r)
}
y = 4294967296
r = x / y
if r != 0 {
t.Errorf("1 %s 4294967296 = %d, want 0", "/", r)
}
y = 9223372036854775806
r = x / y
if r != 0 {
t.Errorf("1 %s 9223372036854775806 = %d, want 0", "/", r)
}
y = 9223372036854775807
r = x / y
if r != 0 {
t.Errorf("1 %s 9223372036854775807 = %d, want 0", "/", r)
}
x = 4294967296
y = -9223372036854775808
r = x / y
if r != 0 {
t.Errorf("4294967296 %s -9223372036854775808 = %d, want 0", "/", r)
}
y = -9223372036854775807
r = x / y
if r != 0 {
t.Errorf("4294967296 %s -9223372036854775807 = %d, want 0", "/", r)
}
y = -4294967296
r = x / y
if r != -1 {
t.Errorf("4294967296 %s -4294967296 = %d, want -1", "/", r)
}
y = -1
r = x / y
if r != -4294967296 {
t.Errorf("4294967296 %s -1 = %d, want -4294967296", "/", r)
}
y = 1
r = x / y
if r != 4294967296 {
t.Errorf("4294967296 %s 1 = %d, want 4294967296", "/", r)
}
y = 4294967296
r = x / y
if r != 1 {
t.Errorf("4294967296 %s 4294967296 = %d, want 1", "/", r)
}
y = 9223372036854775806
r = x / y
if r != 0 {
t.Errorf("4294967296 %s 9223372036854775806 = %d, want 0", "/", r)
}
y = 9223372036854775807
r = x / y
if r != 0 {
t.Errorf("4294967296 %s 9223372036854775807 = %d, want 0", "/", r)
}
x = 9223372036854775806
y = -9223372036854775808
r = x / y
if r != 0 {
t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want 0", "/", r)
}
y = -9223372036854775807
r = x / y
if r != 0 {
t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want 0", "/", r)
}
y = -4294967296
r = x / y
if r != -2147483647 {
t.Errorf("9223372036854775806 %s -4294967296 = %d, want -2147483647", "/", r)
}
y = -1
r = x / y
if r != -9223372036854775806 {
t.Errorf("9223372036854775806 %s -1 = %d, want -9223372036854775806", "/", r)
}
y = 1
r = x / y
if r != 9223372036854775806 {
t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775806", "/", r)
}
y = 4294967296
r = x / y
if r != 2147483647 {
t.Errorf("9223372036854775806 %s 4294967296 = %d, want 2147483647", "/", r)
}
y = 9223372036854775806
r = x / y
if r != 1 {
t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 1", "/", r)
}
y = 9223372036854775807
r = x / y
if r != 0 {
t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want 0", "/", r)
}
x = 9223372036854775807
y = -9223372036854775808
r = x / y
if r != 0 {
t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want 0", "/", r)
}
y = -9223372036854775807
r = x / y
if r != -1 {
t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want -1", "/", r)
}
y = -4294967296
r = x / y
if r != -2147483647 {
t.Errorf("9223372036854775807 %s -4294967296 = %d, want -2147483647", "/", r)
}
y = -1
r = x / y
if r != -9223372036854775807 {
t.Errorf("9223372036854775807 %s -1 = %d, want -9223372036854775807", "/", r)
}
y = 1
r = x / y
if r != 9223372036854775807 {
t.Errorf("9223372036854775807 %s 1 = %d, want 9223372036854775807", "/", r)
}
y = 4294967296
r = x / y
if r != 2147483647 {
t.Errorf("9223372036854775807 %s 4294967296 = %d, want 2147483647", "/", r)
}
y = 9223372036854775806
r = x / y
if r != 1 {
t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want 1", "/", r)
}
y = 9223372036854775807
r = x / y
if r != 1 {
t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 1", "/", r)
}
}
func TestConstFoldint64mul(t *testing.T) {
var x, y, r int64
x = -9223372036854775808
y = -9223372036854775808
r = x * y
if r != 0 {
t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "*", r)
}
y = -9223372036854775807
r = x * y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want -9223372036854775808", "*", r)
}
y = -4294967296
r = x * y
if r != 0 {
t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 0", "*", r)
}
y = -1
r = x * y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775808 %s -1 = %d, want -9223372036854775808", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("-9223372036854775808 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775808 %s 1 = %d, want -9223372036854775808", "*", r)
}
y = 4294967296
r = x * y
if r != 0 {
t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 0", "*", r)
}
y = 9223372036854775806
r = x * y
if r != 0 {
t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want 0", "*", r)
}
y = 9223372036854775807
r = x * y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -9223372036854775808", "*", r)
}
x = -9223372036854775807
y = -9223372036854775808
r = x * y
if r != -9223372036854775808 {
t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r)
}
y = -9223372036854775807
r = x * y
if r != 1 {
t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 1", "*", r)
}
y = -4294967296
r = x * y
if r != -4294967296 {
t.Errorf("-9223372036854775807 %s -4294967296 = %d, want -4294967296", "*", r)
}
y = -1
r = x * y
if r != 9223372036854775807 {
t.Errorf("-9223372036854775807 %s -1 = %d, want 9223372036854775807", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("-9223372036854775807 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != -9223372036854775807 {
t.Errorf("-9223372036854775807 %s 1 = %d, want -9223372036854775807", "*", r)
}
y = 4294967296
r = x * y
if r != 4294967296 {
t.Errorf("-9223372036854775807 %s 4294967296 = %d, want 4294967296", "*", r)
}
y = 9223372036854775806
r = x * y
if r != 9223372036854775806 {
t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want 9223372036854775806", "*", r)
}
y = 9223372036854775807
r = x * y
if r != -1 {
t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want -1", "*", r)
}
x = -4294967296
y = -9223372036854775808
r = x * y
if r != 0 {
t.Errorf("-4294967296 %s -9223372036854775808 = %d, want 0", "*", r)
}
y = -9223372036854775807
r = x * y
if r != -4294967296 {
t.Errorf("-4294967296 %s -9223372036854775807 = %d, want -4294967296", "*", r)
}
y = -4294967296
r = x * y
if r != 0 {
t.Errorf("-4294967296 %s -4294967296 = %d, want 0", "*", r)
}
y = -1
r = x * y
if r != 4294967296 {
t.Errorf("-4294967296 %s -1 = %d, want 4294967296", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("-4294967296 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != -4294967296 {
t.Errorf("-4294967296 %s 1 = %d, want -4294967296", "*", r)
}
y = 4294967296
r = x * y
if r != 0 {
t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "*", r)
}
y = 9223372036854775806
r = x * y
if r != 8589934592 {
t.Errorf("-4294967296 %s 9223372036854775806 = %d, want 8589934592", "*", r)
}
y = 9223372036854775807
r = x * y
if r != 4294967296 {
t.Errorf("-4294967296 %s 9223372036854775807 = %d, want 4294967296", "*", r)
}
x = -1
y = -9223372036854775808
r = x * y
if r != -9223372036854775808 {
t.Errorf("-1 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r)
}
y = -9223372036854775807
r = x * y
if r != 9223372036854775807 {
t.Errorf("-1 %s -9223372036854775807 = %d, want 9223372036854775807", "*", r)
}
y = -4294967296
r = x * y
if r != 4294967296 {
t.Errorf("-1 %s -4294967296 = %d, want 4294967296", "*", r)
}
y = -1
r = x * y
if r != 1 {
t.Errorf("-1 %s -1 = %d, want 1", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("-1 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != -1 {
t.Errorf("-1 %s 1 = %d, want -1", "*", r)
}
y = 4294967296
r = x * y
if r != -4294967296 {
t.Errorf("-1 %s 4294967296 = %d, want -4294967296", "*", r)
}
y = 9223372036854775806
r = x * y
if r != -9223372036854775806 {
t.Errorf("-1 %s 9223372036854775806 = %d, want -9223372036854775806", "*", r)
}
y = 9223372036854775807
r = x * y
if r != -9223372036854775807 {
t.Errorf("-1 %s 9223372036854775807 = %d, want -9223372036854775807", "*", r)
}
x = 0
y = -9223372036854775808
r = x * y
if r != 0 {
t.Errorf("0 %s -9223372036854775808 = %d, want 0", "*", r)
}
y = -9223372036854775807
r = x * y
if r != 0 {
t.Errorf("0 %s -9223372036854775807 = %d, want 0", "*", r)
}
y = -4294967296
r = x * y
if r != 0 {
t.Errorf("0 %s -4294967296 = %d, want 0", "*", r)
}
y = -1
r = x * y
if r != 0 {
t.Errorf("0 %s -1 = %d, want 0", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "*", r)
}
y = 4294967296
r = x * y
if r != 0 {
t.Errorf("0 %s 4294967296 = %d, want 0", "*", r)
}
y = 9223372036854775806
r = x * y
if r != 0 {
t.Errorf("0 %s 9223372036854775806 = %d, want 0", "*", r)
}
y = 9223372036854775807
r = x * y
if r != 0 {
t.Errorf("0 %s 9223372036854775807 = %d, want 0", "*", r)
}
x = 1
y = -9223372036854775808
r = x * y
if r != -9223372036854775808 {
t.Errorf("1 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r)
}
y = -9223372036854775807
r = x * y
if r != -9223372036854775807 {
t.Errorf("1 %s -9223372036854775807 = %d, want -9223372036854775807", "*", r)
}
y = -4294967296
r = x * y
if r != -4294967296 {
t.Errorf("1 %s -4294967296 = %d, want -4294967296", "*", r)
}
y = -1
r = x * y
if r != -1 {
t.Errorf("1 %s -1 = %d, want -1", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("1 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 1 {
t.Errorf("1 %s 1 = %d, want 1", "*", r)
}
y = 4294967296
r = x * y
if r != 4294967296 {
t.Errorf("1 %s 4294967296 = %d, want 4294967296", "*", r)
}
y = 9223372036854775806
r = x * y
if r != 9223372036854775806 {
t.Errorf("1 %s 9223372036854775806 = %d, want 9223372036854775806", "*", r)
}
y = 9223372036854775807
r = x * y
if r != 9223372036854775807 {
t.Errorf("1 %s 9223372036854775807 = %d, want 9223372036854775807", "*", r)
}
x = 4294967296
y = -9223372036854775808
r = x * y
if r != 0 {
t.Errorf("4294967296 %s -9223372036854775808 = %d, want 0", "*", r)
}
y = -9223372036854775807
r = x * y
if r != 4294967296 {
t.Errorf("4294967296 %s -9223372036854775807 = %d, want 4294967296", "*", r)
}
y = -4294967296
r = x * y
if r != 0 {
t.Errorf("4294967296 %s -4294967296 = %d, want 0", "*", r)
}
y = -1
r = x * y
if r != -4294967296 {
t.Errorf("4294967296 %s -1 = %d, want -4294967296", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("4294967296 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 4294967296 {
t.Errorf("4294967296 %s 1 = %d, want 4294967296", "*", r)
}
y = 4294967296
r = x * y
if r != 0 {
t.Errorf("4294967296 %s 4294967296 = %d, want 0", "*", r)
}
y = 9223372036854775806
r = x * y
if r != -8589934592 {
t.Errorf("4294967296 %s 9223372036854775806 = %d, want -8589934592", "*", r)
}
y = 9223372036854775807
r = x * y
if r != -4294967296 {
t.Errorf("4294967296 %s 9223372036854775807 = %d, want -4294967296", "*", r)
}
x = 9223372036854775806
y = -9223372036854775808
r = x * y
if r != 0 {
t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want 0", "*", r)
}
y = -9223372036854775807
r = x * y
if r != 9223372036854775806 {
t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want 9223372036854775806", "*", r)
}
y = -4294967296
r = x * y
if r != 8589934592 {
t.Errorf("9223372036854775806 %s -4294967296 = %d, want 8589934592", "*", r)
}
y = -1
r = x * y
if r != -9223372036854775806 {
t.Errorf("9223372036854775806 %s -1 = %d, want -9223372036854775806", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("9223372036854775806 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 9223372036854775806 {
t.Errorf("9223372036854775806 %s 1 = %d, want 9223372036854775806", "*", r)
}
y = 4294967296
r = x * y
if r != -8589934592 {
t.Errorf("9223372036854775806 %s 4294967296 = %d, want -8589934592", "*", r)
}
y = 9223372036854775806
r = x * y
if r != 4 {
t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 4", "*", r)
}
y = 9223372036854775807
r = x * y
if r != -9223372036854775806 {
t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want -9223372036854775806", "*", r)
}
x = 9223372036854775807
y = -9223372036854775808
r = x * y
if r != -9223372036854775808 {
t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want -9223372036854775808", "*", r)
}
y = -9223372036854775807
r = x * y
if r != -1 {
t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want -1", "*", r)
}
y = -4294967296
r = x * y
if r != 4294967296 {
t.Errorf("9223372036854775807 %s -4294967296 = %d, want 4294967296", "*", r)
}
y = -1
r = x * y
if r != -9223372036854775807 {
t.Errorf("9223372036854775807 %s -1 = %d, want -9223372036854775807", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("9223372036854775807 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 9223372036854775807 {
t.Errorf("9223372036854775807 %s 1 = %d, want 9223372036854775807", "*", r)
}
y = 4294967296
r = x * y
if r != -4294967296 {
t.Errorf("9223372036854775807 %s 4294967296 = %d, want -4294967296", "*", r)
}
y = 9223372036854775806
r = x * y
if r != -9223372036854775806 {
t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want -9223372036854775806", "*", r)
}
y = 9223372036854775807
r = x * y
if r != 1 {
t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 1", "*", r)
}
}
func TestConstFoldint64mod(t *testing.T) {
var x, y, r int64
x = -9223372036854775808
y = -9223372036854775808
r = x % y
if r != 0 {
t.Errorf("-9223372036854775808 %s -9223372036854775808 = %d, want 0", "%", r)
}
y = -9223372036854775807
r = x % y
if r != -1 {
t.Errorf("-9223372036854775808 %s -9223372036854775807 = %d, want -1", "%", r)
}
y = -4294967296
r = x % y
if r != 0 {
t.Errorf("-9223372036854775808 %s -4294967296 = %d, want 0", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("-9223372036854775808 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("-9223372036854775808 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 0 {
t.Errorf("-9223372036854775808 %s 4294967296 = %d, want 0", "%", r)
}
y = 9223372036854775806
r = x % y
if r != -2 {
t.Errorf("-9223372036854775808 %s 9223372036854775806 = %d, want -2", "%", r)
}
y = 9223372036854775807
r = x % y
if r != -1 {
t.Errorf("-9223372036854775808 %s 9223372036854775807 = %d, want -1", "%", r)
}
x = -9223372036854775807
y = -9223372036854775808
r = x % y
if r != -9223372036854775807 {
t.Errorf("-9223372036854775807 %s -9223372036854775808 = %d, want -9223372036854775807", "%", r)
}
y = -9223372036854775807
r = x % y
if r != 0 {
t.Errorf("-9223372036854775807 %s -9223372036854775807 = %d, want 0", "%", r)
}
y = -4294967296
r = x % y
if r != -4294967295 {
t.Errorf("-9223372036854775807 %s -4294967296 = %d, want -4294967295", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("-9223372036854775807 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("-9223372036854775807 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != -4294967295 {
t.Errorf("-9223372036854775807 %s 4294967296 = %d, want -4294967295", "%", r)
}
y = 9223372036854775806
r = x % y
if r != -1 {
t.Errorf("-9223372036854775807 %s 9223372036854775806 = %d, want -1", "%", r)
}
y = 9223372036854775807
r = x % y
if r != 0 {
t.Errorf("-9223372036854775807 %s 9223372036854775807 = %d, want 0", "%", r)
}
x = -4294967296
y = -9223372036854775808
r = x % y
if r != -4294967296 {
t.Errorf("-4294967296 %s -9223372036854775808 = %d, want -4294967296", "%", r)
}
y = -9223372036854775807
r = x % y
if r != -4294967296 {
t.Errorf("-4294967296 %s -9223372036854775807 = %d, want -4294967296", "%", r)
}
y = -4294967296
r = x % y
if r != 0 {
t.Errorf("-4294967296 %s -4294967296 = %d, want 0", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("-4294967296 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("-4294967296 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 0 {
t.Errorf("-4294967296 %s 4294967296 = %d, want 0", "%", r)
}
y = 9223372036854775806
r = x % y
if r != -4294967296 {
t.Errorf("-4294967296 %s 9223372036854775806 = %d, want -4294967296", "%", r)
}
y = 9223372036854775807
r = x % y
if r != -4294967296 {
t.Errorf("-4294967296 %s 9223372036854775807 = %d, want -4294967296", "%", r)
}
x = -1
y = -9223372036854775808
r = x % y
if r != -1 {
t.Errorf("-1 %s -9223372036854775808 = %d, want -1", "%", r)
}
y = -9223372036854775807
r = x % y
if r != -1 {
t.Errorf("-1 %s -9223372036854775807 = %d, want -1", "%", r)
}
y = -4294967296
r = x % y
if r != -1 {
t.Errorf("-1 %s -4294967296 = %d, want -1", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("-1 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("-1 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != -1 {
t.Errorf("-1 %s 4294967296 = %d, want -1", "%", r)
}
y = 9223372036854775806
r = x % y
if r != -1 {
t.Errorf("-1 %s 9223372036854775806 = %d, want -1", "%", r)
}
y = 9223372036854775807
r = x % y
if r != -1 {
t.Errorf("-1 %s 9223372036854775807 = %d, want -1", "%", r)
}
x = 0
y = -9223372036854775808
r = x % y
if r != 0 {
t.Errorf("0 %s -9223372036854775808 = %d, want 0", "%", r)
}
y = -9223372036854775807
r = x % y
if r != 0 {
t.Errorf("0 %s -9223372036854775807 = %d, want 0", "%", r)
}
y = -4294967296
r = x % y
if r != 0 {
t.Errorf("0 %s -4294967296 = %d, want 0", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("0 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 0 {
t.Errorf("0 %s 4294967296 = %d, want 0", "%", r)
}
y = 9223372036854775806
r = x % y
if r != 0 {
t.Errorf("0 %s 9223372036854775806 = %d, want 0", "%", r)
}
y = 9223372036854775807
r = x % y
if r != 0 {
t.Errorf("0 %s 9223372036854775807 = %d, want 0", "%", r)
}
x = 1
y = -9223372036854775808
r = x % y
if r != 1 {
t.Errorf("1 %s -9223372036854775808 = %d, want 1", "%", r)
}
y = -9223372036854775807
r = x % y
if r != 1 {
t.Errorf("1 %s -9223372036854775807 = %d, want 1", "%", r)
}
y = -4294967296
r = x % y
if r != 1 {
t.Errorf("1 %s -4294967296 = %d, want 1", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("1 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("1 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 1 {
t.Errorf("1 %s 4294967296 = %d, want 1", "%", r)
}
y = 9223372036854775806
r = x % y
if r != 1 {
t.Errorf("1 %s 9223372036854775806 = %d, want 1", "%", r)
}
y = 9223372036854775807
r = x % y
if r != 1 {
t.Errorf("1 %s 9223372036854775807 = %d, want 1", "%", r)
}
x = 4294967296
y = -9223372036854775808
r = x % y
if r != 4294967296 {
t.Errorf("4294967296 %s -9223372036854775808 = %d, want 4294967296", "%", r)
}
y = -9223372036854775807
r = x % y
if r != 4294967296 {
t.Errorf("4294967296 %s -9223372036854775807 = %d, want 4294967296", "%", r)
}
y = -4294967296
r = x % y
if r != 0 {
t.Errorf("4294967296 %s -4294967296 = %d, want 0", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("4294967296 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("4294967296 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 0 {
t.Errorf("4294967296 %s 4294967296 = %d, want 0", "%", r)
}
y = 9223372036854775806
r = x % y
if r != 4294967296 {
t.Errorf("4294967296 %s 9223372036854775806 = %d, want 4294967296", "%", r)
}
y = 9223372036854775807
r = x % y
if r != 4294967296 {
t.Errorf("4294967296 %s 9223372036854775807 = %d, want 4294967296", "%", r)
}
x = 9223372036854775806
y = -9223372036854775808
r = x % y
if r != 9223372036854775806 {
t.Errorf("9223372036854775806 %s -9223372036854775808 = %d, want 9223372036854775806", "%", r)
}
y = -9223372036854775807
r = x % y
if r != 9223372036854775806 {
t.Errorf("9223372036854775806 %s -9223372036854775807 = %d, want 9223372036854775806", "%", r)
}
y = -4294967296
r = x % y
if r != 4294967294 {
t.Errorf("9223372036854775806 %s -4294967296 = %d, want 4294967294", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("9223372036854775806 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("9223372036854775806 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 4294967294 {
t.Errorf("9223372036854775806 %s 4294967296 = %d, want 4294967294", "%", r)
}
y = 9223372036854775806
r = x % y
if r != 0 {
t.Errorf("9223372036854775806 %s 9223372036854775806 = %d, want 0", "%", r)
}
y = 9223372036854775807
r = x % y
if r != 9223372036854775806 {
t.Errorf("9223372036854775806 %s 9223372036854775807 = %d, want 9223372036854775806", "%", r)
}
x = 9223372036854775807
y = -9223372036854775808
r = x % y
if r != 9223372036854775807 {
t.Errorf("9223372036854775807 %s -9223372036854775808 = %d, want 9223372036854775807", "%", r)
}
y = -9223372036854775807
r = x % y
if r != 0 {
t.Errorf("9223372036854775807 %s -9223372036854775807 = %d, want 0", "%", r)
}
y = -4294967296
r = x % y
if r != 4294967295 {
t.Errorf("9223372036854775807 %s -4294967296 = %d, want 4294967295", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("9223372036854775807 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("9223372036854775807 %s 1 = %d, want 0", "%", r)
}
y = 4294967296
r = x % y
if r != 4294967295 {
t.Errorf("9223372036854775807 %s 4294967296 = %d, want 4294967295", "%", r)
}
y = 9223372036854775806
r = x % y
if r != 1 {
t.Errorf("9223372036854775807 %s 9223372036854775806 = %d, want 1", "%", r)
}
y = 9223372036854775807
r = x % y
if r != 0 {
t.Errorf("9223372036854775807 %s 9223372036854775807 = %d, want 0", "%", r)
}
}
func TestConstFolduint32add(t *testing.T) {
var x, y, r uint32
x = 0
y = 0
r = x + y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "+", r)
}
y = 1
r = x + y
if r != 1 {
t.Errorf("0 %s 1 = %d, want 1", "+", r)
}
y = 4294967295
r = x + y
if r != 4294967295 {
t.Errorf("0 %s 4294967295 = %d, want 4294967295", "+", r)
}
x = 1
y = 0
r = x + y
if r != 1 {
t.Errorf("1 %s 0 = %d, want 1", "+", r)
}
y = 1
r = x + y
if r != 2 {
t.Errorf("1 %s 1 = %d, want 2", "+", r)
}
y = 4294967295
r = x + y
if r != 0 {
t.Errorf("1 %s 4294967295 = %d, want 0", "+", r)
}
x = 4294967295
y = 0
r = x + y
if r != 4294967295 {
t.Errorf("4294967295 %s 0 = %d, want 4294967295", "+", r)
}
y = 1
r = x + y
if r != 0 {
t.Errorf("4294967295 %s 1 = %d, want 0", "+", r)
}
y = 4294967295
r = x + y
if r != 4294967294 {
t.Errorf("4294967295 %s 4294967295 = %d, want 4294967294", "+", r)
}
}
func TestConstFolduint32sub(t *testing.T) {
var x, y, r uint32
x = 0
y = 0
r = x - y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "-", r)
}
y = 1
r = x - y
if r != 4294967295 {
t.Errorf("0 %s 1 = %d, want 4294967295", "-", r)
}
y = 4294967295
r = x - y
if r != 1 {
t.Errorf("0 %s 4294967295 = %d, want 1", "-", r)
}
x = 1
y = 0
r = x - y
if r != 1 {
t.Errorf("1 %s 0 = %d, want 1", "-", r)
}
y = 1
r = x - y
if r != 0 {
t.Errorf("1 %s 1 = %d, want 0", "-", r)
}
y = 4294967295
r = x - y
if r != 2 {
t.Errorf("1 %s 4294967295 = %d, want 2", "-", r)
}
x = 4294967295
y = 0
r = x - y
if r != 4294967295 {
t.Errorf("4294967295 %s 0 = %d, want 4294967295", "-", r)
}
y = 1
r = x - y
if r != 4294967294 {
t.Errorf("4294967295 %s 1 = %d, want 4294967294", "-", r)
}
y = 4294967295
r = x - y
if r != 0 {
t.Errorf("4294967295 %s 4294967295 = %d, want 0", "-", r)
}
}
func TestConstFolduint32div(t *testing.T) {
var x, y, r uint32
x = 0
y = 1
r = x / y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "/", r)
}
y = 4294967295
r = x / y
if r != 0 {
t.Errorf("0 %s 4294967295 = %d, want 0", "/", r)
}
x = 1
y = 1
r = x / y
if r != 1 {
t.Errorf("1 %s 1 = %d, want 1", "/", r)
}
y = 4294967295
r = x / y
if r != 0 {
t.Errorf("1 %s 4294967295 = %d, want 0", "/", r)
}
x = 4294967295
y = 1
r = x / y
if r != 4294967295 {
t.Errorf("4294967295 %s 1 = %d, want 4294967295", "/", r)
}
y = 4294967295
r = x / y
if r != 1 {
t.Errorf("4294967295 %s 4294967295 = %d, want 1", "/", r)
}
}
func TestConstFolduint32mul(t *testing.T) {
var x, y, r uint32
x = 0
y = 0
r = x * y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "*", r)
}
y = 4294967295
r = x * y
if r != 0 {
t.Errorf("0 %s 4294967295 = %d, want 0", "*", r)
}
x = 1
y = 0
r = x * y
if r != 0 {
t.Errorf("1 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 1 {
t.Errorf("1 %s 1 = %d, want 1", "*", r)
}
y = 4294967295
r = x * y
if r != 4294967295 {
t.Errorf("1 %s 4294967295 = %d, want 4294967295", "*", r)
}
x = 4294967295
y = 0
r = x * y
if r != 0 {
t.Errorf("4294967295 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 4294967295 {
t.Errorf("4294967295 %s 1 = %d, want 4294967295", "*", r)
}
y = 4294967295
r = x * y
if r != 1 {
t.Errorf("4294967295 %s 4294967295 = %d, want 1", "*", r)
}
}
func TestConstFolduint32mod(t *testing.T) {
var x, y, r uint32
x = 0
y = 1
r = x % y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "%", r)
}
y = 4294967295
r = x % y
if r != 0 {
t.Errorf("0 %s 4294967295 = %d, want 0", "%", r)
}
x = 1
y = 1
r = x % y
if r != 0 {
t.Errorf("1 %s 1 = %d, want 0", "%", r)
}
y = 4294967295
r = x % y
if r != 1 {
t.Errorf("1 %s 4294967295 = %d, want 1", "%", r)
}
x = 4294967295
y = 1
r = x % y
if r != 0 {
t.Errorf("4294967295 %s 1 = %d, want 0", "%", r)
}
y = 4294967295
r = x % y
if r != 0 {
t.Errorf("4294967295 %s 4294967295 = %d, want 0", "%", r)
}
}
func TestConstFoldint32add(t *testing.T) {
var x, y, r int32
x = -2147483648
y = -2147483648
r = x + y
if r != 0 {
t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "+", r)
}
y = -2147483647
r = x + y
if r != 1 {
t.Errorf("-2147483648 %s -2147483647 = %d, want 1", "+", r)
}
y = -1
r = x + y
if r != 2147483647 {
t.Errorf("-2147483648 %s -1 = %d, want 2147483647", "+", r)
}
y = 0
r = x + y
if r != -2147483648 {
t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "+", r)
}
y = 1
r = x + y
if r != -2147483647 {
t.Errorf("-2147483648 %s 1 = %d, want -2147483647", "+", r)
}
y = 2147483647
r = x + y
if r != -1 {
t.Errorf("-2147483648 %s 2147483647 = %d, want -1", "+", r)
}
x = -2147483647
y = -2147483648
r = x + y
if r != 1 {
t.Errorf("-2147483647 %s -2147483648 = %d, want 1", "+", r)
}
y = -2147483647
r = x + y
if r != 2 {
t.Errorf("-2147483647 %s -2147483647 = %d, want 2", "+", r)
}
y = -1
r = x + y
if r != -2147483648 {
t.Errorf("-2147483647 %s -1 = %d, want -2147483648", "+", r)
}
y = 0
r = x + y
if r != -2147483647 {
t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "+", r)
}
y = 1
r = x + y
if r != -2147483646 {
t.Errorf("-2147483647 %s 1 = %d, want -2147483646", "+", r)
}
y = 2147483647
r = x + y
if r != 0 {
t.Errorf("-2147483647 %s 2147483647 = %d, want 0", "+", r)
}
x = -1
y = -2147483648
r = x + y
if r != 2147483647 {
t.Errorf("-1 %s -2147483648 = %d, want 2147483647", "+", r)
}
y = -2147483647
r = x + y
if r != -2147483648 {
t.Errorf("-1 %s -2147483647 = %d, want -2147483648", "+", r)
}
y = -1
r = x + y
if r != -2 {
t.Errorf("-1 %s -1 = %d, want -2", "+", r)
}
y = 0
r = x + y
if r != -1 {
t.Errorf("-1 %s 0 = %d, want -1", "+", r)
}
y = 1
r = x + y
if r != 0 {
t.Errorf("-1 %s 1 = %d, want 0", "+", r)
}
y = 2147483647
r = x + y
if r != 2147483646 {
t.Errorf("-1 %s 2147483647 = %d, want 2147483646", "+", r)
}
x = 0
y = -2147483648
r = x + y
if r != -2147483648 {
t.Errorf("0 %s -2147483648 = %d, want -2147483648", "+", r)
}
y = -2147483647
r = x + y
if r != -2147483647 {
t.Errorf("0 %s -2147483647 = %d, want -2147483647", "+", r)
}
y = -1
r = x + y
if r != -1 {
t.Errorf("0 %s -1 = %d, want -1", "+", r)
}
y = 0
r = x + y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "+", r)
}
y = 1
r = x + y
if r != 1 {
t.Errorf("0 %s 1 = %d, want 1", "+", r)
}
y = 2147483647
r = x + y
if r != 2147483647 {
t.Errorf("0 %s 2147483647 = %d, want 2147483647", "+", r)
}
x = 1
y = -2147483648
r = x + y
if r != -2147483647 {
t.Errorf("1 %s -2147483648 = %d, want -2147483647", "+", r)
}
y = -2147483647
r = x + y
if r != -2147483646 {
t.Errorf("1 %s -2147483647 = %d, want -2147483646", "+", r)
}
y = -1
r = x + y
if r != 0 {
t.Errorf("1 %s -1 = %d, want 0", "+", r)
}
y = 0
r = x + y
if r != 1 {
t.Errorf("1 %s 0 = %d, want 1", "+", r)
}
y = 1
r = x + y
if r != 2 {
t.Errorf("1 %s 1 = %d, want 2", "+", r)
}
y = 2147483647
r = x + y
if r != -2147483648 {
t.Errorf("1 %s 2147483647 = %d, want -2147483648", "+", r)
}
x = 2147483647
y = -2147483648
r = x + y
if r != -1 {
t.Errorf("2147483647 %s -2147483648 = %d, want -1", "+", r)
}
y = -2147483647
r = x + y
if r != 0 {
t.Errorf("2147483647 %s -2147483647 = %d, want 0", "+", r)
}
y = -1
r = x + y
if r != 2147483646 {
t.Errorf("2147483647 %s -1 = %d, want 2147483646", "+", r)
}
y = 0
r = x + y
if r != 2147483647 {
t.Errorf("2147483647 %s 0 = %d, want 2147483647", "+", r)
}
y = 1
r = x + y
if r != -2147483648 {
t.Errorf("2147483647 %s 1 = %d, want -2147483648", "+", r)
}
y = 2147483647
r = x + y
if r != -2 {
t.Errorf("2147483647 %s 2147483647 = %d, want -2", "+", r)
}
}
func TestConstFoldint32sub(t *testing.T) {
var x, y, r int32
x = -2147483648
y = -2147483648
r = x - y
if r != 0 {
t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "-", r)
}
y = -2147483647
r = x - y
if r != -1 {
t.Errorf("-2147483648 %s -2147483647 = %d, want -1", "-", r)
}
y = -1
r = x - y
if r != -2147483647 {
t.Errorf("-2147483648 %s -1 = %d, want -2147483647", "-", r)
}
y = 0
r = x - y
if r != -2147483648 {
t.Errorf("-2147483648 %s 0 = %d, want -2147483648", "-", r)
}
y = 1
r = x - y
if r != 2147483647 {
t.Errorf("-2147483648 %s 1 = %d, want 2147483647", "-", r)
}
y = 2147483647
r = x - y
if r != 1 {
t.Errorf("-2147483648 %s 2147483647 = %d, want 1", "-", r)
}
x = -2147483647
y = -2147483648
r = x - y
if r != 1 {
t.Errorf("-2147483647 %s -2147483648 = %d, want 1", "-", r)
}
y = -2147483647
r = x - y
if r != 0 {
t.Errorf("-2147483647 %s -2147483647 = %d, want 0", "-", r)
}
y = -1
r = x - y
if r != -2147483646 {
t.Errorf("-2147483647 %s -1 = %d, want -2147483646", "-", r)
}
y = 0
r = x - y
if r != -2147483647 {
t.Errorf("-2147483647 %s 0 = %d, want -2147483647", "-", r)
}
y = 1
r = x - y
if r != -2147483648 {
t.Errorf("-2147483647 %s 1 = %d, want -2147483648", "-", r)
}
y = 2147483647
r = x - y
if r != 2 {
t.Errorf("-2147483647 %s 2147483647 = %d, want 2", "-", r)
}
x = -1
y = -2147483648
r = x - y
if r != 2147483647 {
t.Errorf("-1 %s -2147483648 = %d, want 2147483647", "-", r)
}
y = -2147483647
r = x - y
if r != 2147483646 {
t.Errorf("-1 %s -2147483647 = %d, want 2147483646", "-", r)
}
y = -1
r = x - y
if r != 0 {
t.Errorf("-1 %s -1 = %d, want 0", "-", r)
}
y = 0
r = x - y
if r != -1 {
t.Errorf("-1 %s 0 = %d, want -1", "-", r)
}
y = 1
r = x - y
if r != -2 {
t.Errorf("-1 %s 1 = %d, want -2", "-", r)
}
y = 2147483647
r = x - y
if r != -2147483648 {
t.Errorf("-1 %s 2147483647 = %d, want -2147483648", "-", r)
}
x = 0
y = -2147483648
r = x - y
if r != -2147483648 {
t.Errorf("0 %s -2147483648 = %d, want -2147483648", "-", r)
}
y = -2147483647
r = x - y
if r != 2147483647 {
t.Errorf("0 %s -2147483647 = %d, want 2147483647", "-", r)
}
y = -1
r = x - y
if r != 1 {
t.Errorf("0 %s -1 = %d, want 1", "-", r)
}
y = 0
r = x - y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "-", r)
}
y = 1
r = x - y
if r != -1 {
t.Errorf("0 %s 1 = %d, want -1", "-", r)
}
y = 2147483647
r = x - y
if r != -2147483647 {
t.Errorf("0 %s 2147483647 = %d, want -2147483647", "-", r)
}
x = 1
y = -2147483648
r = x - y
if r != -2147483647 {
t.Errorf("1 %s -2147483648 = %d, want -2147483647", "-", r)
}
y = -2147483647
r = x - y
if r != -2147483648 {
t.Errorf("1 %s -2147483647 = %d, want -2147483648", "-", r)
}
y = -1
r = x - y
if r != 2 {
t.Errorf("1 %s -1 = %d, want 2", "-", r)
}
y = 0
r = x - y
if r != 1 {
t.Errorf("1 %s 0 = %d, want 1", "-", r)
}
y = 1
r = x - y
if r != 0 {
t.Errorf("1 %s 1 = %d, want 0", "-", r)
}
y = 2147483647
r = x - y
if r != -2147483646 {
t.Errorf("1 %s 2147483647 = %d, want -2147483646", "-", r)
}
x = 2147483647
y = -2147483648
r = x - y
if r != -1 {
t.Errorf("2147483647 %s -2147483648 = %d, want -1", "-", r)
}
y = -2147483647
r = x - y
if r != -2 {
t.Errorf("2147483647 %s -2147483647 = %d, want -2", "-", r)
}
y = -1
r = x - y
if r != -2147483648 {
t.Errorf("2147483647 %s -1 = %d, want -2147483648", "-", r)
}
y = 0
r = x - y
if r != 2147483647 {
t.Errorf("2147483647 %s 0 = %d, want 2147483647", "-", r)
}
y = 1
r = x - y
if r != 2147483646 {
t.Errorf("2147483647 %s 1 = %d, want 2147483646", "-", r)
}
y = 2147483647
r = x - y
if r != 0 {
t.Errorf("2147483647 %s 2147483647 = %d, want 0", "-", r)
}
}
func TestConstFoldint32div(t *testing.T) {
var x, y, r int32
x = -2147483648
y = -2147483648
r = x / y
if r != 1 {
t.Errorf("-2147483648 %s -2147483648 = %d, want 1", "/", r)
}
y = -2147483647
r = x / y
if r != 1 {
t.Errorf("-2147483648 %s -2147483647 = %d, want 1", "/", r)
}
y = -1
r = x / y
if r != -2147483648 {
t.Errorf("-2147483648 %s -1 = %d, want -2147483648", "/", r)
}
y = 1
r = x / y
if r != -2147483648 {
t.Errorf("-2147483648 %s 1 = %d, want -2147483648", "/", r)
}
y = 2147483647
r = x / y
if r != -1 {
t.Errorf("-2147483648 %s 2147483647 = %d, want -1", "/", r)
}
x = -2147483647
y = -2147483648
r = x / y
if r != 0 {
t.Errorf("-2147483647 %s -2147483648 = %d, want 0", "/", r)
}
y = -2147483647
r = x / y
if r != 1 {
t.Errorf("-2147483647 %s -2147483647 = %d, want 1", "/", r)
}
y = -1
r = x / y
if r != 2147483647 {
t.Errorf("-2147483647 %s -1 = %d, want 2147483647", "/", r)
}
y = 1
r = x / y
if r != -2147483647 {
t.Errorf("-2147483647 %s 1 = %d, want -2147483647", "/", r)
}
y = 2147483647
r = x / y
if r != -1 {
t.Errorf("-2147483647 %s 2147483647 = %d, want -1", "/", r)
}
x = -1
y = -2147483648
r = x / y
if r != 0 {
t.Errorf("-1 %s -2147483648 = %d, want 0", "/", r)
}
y = -2147483647
r = x / y
if r != 0 {
t.Errorf("-1 %s -2147483647 = %d, want 0", "/", r)
}
y = -1
r = x / y
if r != 1 {
t.Errorf("-1 %s -1 = %d, want 1", "/", r)
}
y = 1
r = x / y
if r != -1 {
t.Errorf("-1 %s 1 = %d, want -1", "/", r)
}
y = 2147483647
r = x / y
if r != 0 {
t.Errorf("-1 %s 2147483647 = %d, want 0", "/", r)
}
x = 0
y = -2147483648
r = x / y
if r != 0 {
t.Errorf("0 %s -2147483648 = %d, want 0", "/", r)
}
y = -2147483647
r = x / y
if r != 0 {
t.Errorf("0 %s -2147483647 = %d, want 0", "/", r)
}
y = -1
r = x / y
if r != 0 {
t.Errorf("0 %s -1 = %d, want 0", "/", r)
}
y = 1
r = x / y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "/", r)
}
y = 2147483647
r = x / y
if r != 0 {
t.Errorf("0 %s 2147483647 = %d, want 0", "/", r)
}
x = 1
y = -2147483648
r = x / y
if r != 0 {
t.Errorf("1 %s -2147483648 = %d, want 0", "/", r)
}
y = -2147483647
r = x / y
if r != 0 {
t.Errorf("1 %s -2147483647 = %d, want 0", "/", r)
}
y = -1
r = x / y
if r != -1 {
t.Errorf("1 %s -1 = %d, want -1", "/", r)
}
y = 1
r = x / y
if r != 1 {
t.Errorf("1 %s 1 = %d, want 1", "/", r)
}
y = 2147483647
r = x / y
if r != 0 {
t.Errorf("1 %s 2147483647 = %d, want 0", "/", r)
}
x = 2147483647
y = -2147483648
r = x / y
if r != 0 {
t.Errorf("2147483647 %s -2147483648 = %d, want 0", "/", r)
}
y = -2147483647
r = x / y
if r != -1 {
t.Errorf("2147483647 %s -2147483647 = %d, want -1", "/", r)
}
y = -1
r = x / y
if r != -2147483647 {
t.Errorf("2147483647 %s -1 = %d, want -2147483647", "/", r)
}
y = 1
r = x / y
if r != 2147483647 {
t.Errorf("2147483647 %s 1 = %d, want 2147483647", "/", r)
}
y = 2147483647
r = x / y
if r != 1 {
t.Errorf("2147483647 %s 2147483647 = %d, want 1", "/", r)
}
}
func TestConstFoldint32mul(t *testing.T) {
var x, y, r int32
x = -2147483648
y = -2147483648
r = x * y
if r != 0 {
t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "*", r)
}
y = -2147483647
r = x * y
if r != -2147483648 {
t.Errorf("-2147483648 %s -2147483647 = %d, want -2147483648", "*", r)
}
y = -1
r = x * y
if r != -2147483648 {
t.Errorf("-2147483648 %s -1 = %d, want -2147483648", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("-2147483648 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != -2147483648 {
t.Errorf("-2147483648 %s 1 = %d, want -2147483648", "*", r)
}
y = 2147483647
r = x * y
if r != -2147483648 {
t.Errorf("-2147483648 %s 2147483647 = %d, want -2147483648", "*", r)
}
x = -2147483647
y = -2147483648
r = x * y
if r != -2147483648 {
t.Errorf("-2147483647 %s -2147483648 = %d, want -2147483648", "*", r)
}
y = -2147483647
r = x * y
if r != 1 {
t.Errorf("-2147483647 %s -2147483647 = %d, want 1", "*", r)
}
y = -1
r = x * y
if r != 2147483647 {
t.Errorf("-2147483647 %s -1 = %d, want 2147483647", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("-2147483647 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != -2147483647 {
t.Errorf("-2147483647 %s 1 = %d, want -2147483647", "*", r)
}
y = 2147483647
r = x * y
if r != -1 {
t.Errorf("-2147483647 %s 2147483647 = %d, want -1", "*", r)
}
x = -1
y = -2147483648
r = x * y
if r != -2147483648 {
t.Errorf("-1 %s -2147483648 = %d, want -2147483648", "*", r)
}
y = -2147483647
r = x * y
if r != 2147483647 {
t.Errorf("-1 %s -2147483647 = %d, want 2147483647", "*", r)
}
y = -1
r = x * y
if r != 1 {
t.Errorf("-1 %s -1 = %d, want 1", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("-1 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != -1 {
t.Errorf("-1 %s 1 = %d, want -1", "*", r)
}
y = 2147483647
r = x * y
if r != -2147483647 {
t.Errorf("-1 %s 2147483647 = %d, want -2147483647", "*", r)
}
x = 0
y = -2147483648
r = x * y
if r != 0 {
t.Errorf("0 %s -2147483648 = %d, want 0", "*", r)
}
y = -2147483647
r = x * y
if r != 0 {
t.Errorf("0 %s -2147483647 = %d, want 0", "*", r)
}
y = -1
r = x * y
if r != 0 {
t.Errorf("0 %s -1 = %d, want 0", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "*", r)
}
y = 2147483647
r = x * y
if r != 0 {
t.Errorf("0 %s 2147483647 = %d, want 0", "*", r)
}
x = 1
y = -2147483648
r = x * y
if r != -2147483648 {
t.Errorf("1 %s -2147483648 = %d, want -2147483648", "*", r)
}
y = -2147483647
r = x * y
if r != -2147483647 {
t.Errorf("1 %s -2147483647 = %d, want -2147483647", "*", r)
}
y = -1
r = x * y
if r != -1 {
t.Errorf("1 %s -1 = %d, want -1", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("1 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 1 {
t.Errorf("1 %s 1 = %d, want 1", "*", r)
}
y = 2147483647
r = x * y
if r != 2147483647 {
t.Errorf("1 %s 2147483647 = %d, want 2147483647", "*", r)
}
x = 2147483647
y = -2147483648
r = x * y
if r != -2147483648 {
t.Errorf("2147483647 %s -2147483648 = %d, want -2147483648", "*", r)
}
y = -2147483647
r = x * y
if r != -1 {
t.Errorf("2147483647 %s -2147483647 = %d, want -1", "*", r)
}
y = -1
r = x * y
if r != -2147483647 {
t.Errorf("2147483647 %s -1 = %d, want -2147483647", "*", r)
}
y = 0
r = x * y
if r != 0 {
t.Errorf("2147483647 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 2147483647 {
t.Errorf("2147483647 %s 1 = %d, want 2147483647", "*", r)
}
y = 2147483647
r = x * y
if r != 1 {
t.Errorf("2147483647 %s 2147483647 = %d, want 1", "*", r)
}
}
func TestConstFoldint32mod(t *testing.T) {
var x, y, r int32
x = -2147483648
y = -2147483648
r = x % y
if r != 0 {
t.Errorf("-2147483648 %s -2147483648 = %d, want 0", "%", r)
}
y = -2147483647
r = x % y
if r != -1 {
t.Errorf("-2147483648 %s -2147483647 = %d, want -1", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("-2147483648 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("-2147483648 %s 1 = %d, want 0", "%", r)
}
y = 2147483647
r = x % y
if r != -1 {
t.Errorf("-2147483648 %s 2147483647 = %d, want -1", "%", r)
}
x = -2147483647
y = -2147483648
r = x % y
if r != -2147483647 {
t.Errorf("-2147483647 %s -2147483648 = %d, want -2147483647", "%", r)
}
y = -2147483647
r = x % y
if r != 0 {
t.Errorf("-2147483647 %s -2147483647 = %d, want 0", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("-2147483647 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("-2147483647 %s 1 = %d, want 0", "%", r)
}
y = 2147483647
r = x % y
if r != 0 {
t.Errorf("-2147483647 %s 2147483647 = %d, want 0", "%", r)
}
x = -1
y = -2147483648
r = x % y
if r != -1 {
t.Errorf("-1 %s -2147483648 = %d, want -1", "%", r)
}
y = -2147483647
r = x % y
if r != -1 {
t.Errorf("-1 %s -2147483647 = %d, want -1", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("-1 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("-1 %s 1 = %d, want 0", "%", r)
}
y = 2147483647
r = x % y
if r != -1 {
t.Errorf("-1 %s 2147483647 = %d, want -1", "%", r)
}
x = 0
y = -2147483648
r = x % y
if r != 0 {
t.Errorf("0 %s -2147483648 = %d, want 0", "%", r)
}
y = -2147483647
r = x % y
if r != 0 {
t.Errorf("0 %s -2147483647 = %d, want 0", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("0 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "%", r)
}
y = 2147483647
r = x % y
if r != 0 {
t.Errorf("0 %s 2147483647 = %d, want 0", "%", r)
}
x = 1
y = -2147483648
r = x % y
if r != 1 {
t.Errorf("1 %s -2147483648 = %d, want 1", "%", r)
}
y = -2147483647
r = x % y
if r != 1 {
t.Errorf("1 %s -2147483647 = %d, want 1", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("1 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("1 %s 1 = %d, want 0", "%", r)
}
y = 2147483647
r = x % y
if r != 1 {
t.Errorf("1 %s 2147483647 = %d, want 1", "%", r)
}
x = 2147483647
y = -2147483648
r = x % y
if r != 2147483647 {
t.Errorf("2147483647 %s -2147483648 = %d, want 2147483647", "%", r)
}
y = -2147483647
r = x % y
if r != 0 {
t.Errorf("2147483647 %s -2147483647 = %d, want 0", "%", r)
}
y = -1
r = x % y
if r != 0 {
t.Errorf("2147483647 %s -1 = %d, want 0", "%", r)
}
y = 1
r = x % y
if r != 0 {
t.Errorf("2147483647 %s 1 = %d, want 0", "%", r)
}
y = 2147483647
r = x % y
if r != 0 {
t.Errorf("2147483647 %s 2147483647 = %d, want 0", "%", r)
}
}
func TestConstFolduint16add(t *testing.T) {
var x, y, r uint16
x = 0
y = 0
r = x + y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "+", r)
}
y = 1
r = x + y
if r != 1 {
t.Errorf("0 %s 1 = %d, want 1", "+", r)
}
y = 65535
r = x + y
if r != 65535 {
t.Errorf("0 %s 65535 = %d, want 65535", "+", r)
}
x = 1
y = 0
r = x + y
if r != 1 {
t.Errorf("1 %s 0 = %d, want 1", "+", r)
}
y = 1
r = x + y
if r != 2 {
t.Errorf("1 %s 1 = %d, want 2", "+", r)
}
y = 65535
r = x + y
if r != 0 {
t.Errorf("1 %s 65535 = %d, want 0", "+", r)
}
x = 65535
y = 0
r = x + y
if r != 65535 {
t.Errorf("65535 %s 0 = %d, want 65535", "+", r)
}
y = 1
r = x + y
if r != 0 {
t.Errorf("65535 %s 1 = %d, want 0", "+", r)
}
y = 65535
r = x + y
if r != 65534 {
t.Errorf("65535 %s 65535 = %d, want 65534", "+", r)
}
}
func TestConstFolduint16sub(t *testing.T) {
var x, y, r uint16
x = 0
y = 0
r = x - y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "-", r)
}
y = 1
r = x - y
if r != 65535 {
t.Errorf("0 %s 1 = %d, want 65535", "-", r)
}
y = 65535
r = x - y
if r != 1 {
t.Errorf("0 %s 65535 = %d, want 1", "-", r)
}
x = 1
y = 0
r = x - y
if r != 1 {
t.Errorf("1 %s 0 = %d, want 1", "-", r)
}
y = 1
r = x - y
if r != 0 {
t.Errorf("1 %s 1 = %d, want 0", "-", r)
}
y = 65535
r = x - y
if r != 2 {
t.Errorf("1 %s 65535 = %d, want 2", "-", r)
}
x = 65535
y = 0
r = x - y
if r != 65535 {
t.Errorf("65535 %s 0 = %d, want 65535", "-", r)
}
y = 1
r = x - y
if r != 65534 {
t.Errorf("65535 %s 1 = %d, want 65534", "-", r)
}
y = 65535
r = x - y
if r != 0 {
t.Errorf("65535 %s 65535 = %d, want 0", "-", r)
}
}
func TestConstFolduint16div(t *testing.T) {
var x, y, r uint16
x = 0
y = 1
r = x / y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "/", r)
}
y = 65535
r = x / y
if r != 0 {
t.Errorf("0 %s 65535 = %d, want 0", "/", r)
}
x = 1
y = 1
r = x / y
if r != 1 {
t.Errorf("1 %s 1 = %d, want 1", "/", r)
}
y = 65535
r = x / y
if r != 0 {
t.Errorf("1 %s 65535 = %d, want 0", "/", r)
}
x = 65535
y = 1
r = x / y
if r != 65535 {
t.Errorf("65535 %s 1 = %d, want 65535", "/", r)
}
y = 65535
r = x / y
if r != 1 {
t.Errorf("65535 %s 65535 = %d, want 1", "/", r)
}
}
func TestConstFolduint16mul(t *testing.T) {
var x, y, r uint16
x = 0
y = 0
r = x * y
if r != 0 {
t.Errorf("0 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "*", r)
}
y = 65535
r = x * y
if r != 0 {
t.Errorf("0 %s 65535 = %d, want 0", "*", r)
}
x = 1
y = 0
r = x * y
if r != 0 {
t.Errorf("1 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 1 {
t.Errorf("1 %s 1 = %d, want 1", "*", r)
}
y = 65535
r = x * y
if r != 65535 {
t.Errorf("1 %s 65535 = %d, want 65535", "*", r)
}
x = 65535
y = 0
r = x * y
if r != 0 {
t.Errorf("65535 %s 0 = %d, want 0", "*", r)
}
y = 1
r = x * y
if r != 65535 {
t.Errorf("65535 %s 1 = %d, want 65535", "*", r)
}
y = 65535
r = x * y
if r != 1 {
t.Errorf("65535 %s 65535 = %d, want 1", "*", r)
}
}
func TestConstFolduint16mod(t *testing.T) {
var x, y, r uint16
x = 0
y = 1
r = x % y
if r != 0 {
t.Errorf("0 %s 1 = %d, want 0", "%", r)
}
y = 65535
r = x % y
if r != 0 {
t.Errorf("0 %s 65535 = %d, want 0", "%", r)
}
x = 1
y = 1
r = x % y
if r != 0 {
t.Errorf("1 %s 1 = %d, want 0", "%", r)
}
y = 65535
r = x % y
if r != 1 {
t.Errorf("1 %s 65535 = %d, want 1", "%", r)
}
x = 65535
y = 1
r = x % y
if r != 0 {
t.Errorf("65535 %s 1 = %d, want 0", "%", r)
}
y = 65535
r = x % y
if r != 0 {
t.Errorf("65535 %s 65535 = %d, want 0", "%", r)
}
}
func TestConstFoldint16add(t *testing.T) {
var x, y, r int16
x = -32768
y = -32768
r = x + y
if r != 0 {
t.Errorf("-32768 %s -32768 = %d, want 0", "+", r)
}
y = -32767
r = x + y
if r != 1 {
t.Errorf("-32768 %s -32767 = %d, want 1", "+", r)
}
y = -1
r = x + y
if r != 32767 {
t.Errorf("-32768 %s -1 = %d, want 32767", "+", r)
}
y = 0
r = x + y
if r != -32768 {
t.Errorf("-32768 %s 0 = %d, want -32768", "+", r)
}
y = 1
r = x + y
if r != -32767 {
t.Errorf("-32768 %s 1 = %d, want -32767", "+", r)
}
y = 32766
r = x + y
if r != -2 {
t.Errorf("-32768 %s 32766 = %d, want -2", "+", r)
}
y = 32767
r = x + y
if r != -1 {
t.Errorf("-32768 %s 32767 = %d, want -1", "+", r)
}
x = -32767
y = -32768
r = x + y
if r != 1 {
t.Errorf("-32767 %s -32768 = %d, want 1", "+", r)
}
y = -32767