// test_cross_type_operators.hako - 演算子システム強化テスト
// Phase 1: Cross-type operations, string concatenation, comparisons validation

print("🔢 Testing cross-type operators implementation...")

// Test 1: IntegerBox + FloatBox
print("=== Type Conversion Tests ===")
local i, f, result
i = 10
f = new FloatBox(3.14)
result = i + f
print("10 + 3.14 = " + result.toString())

result = f + i
print("3.14 + 10 = " + result.toString())

// Test multiplication
result = i * f
print("10 * 3.14 = " + result.toString())

result = f * i
print("3.14 * 10 = " + result.toString())

// Test division
result = i / f
print("10 / 3.14 = " + result.toString())

result = f / i
print("3.14 / 10 = " + result.toString())

// Test subtraction
result = i - f
print("10 - 3.14 = " + result.toString())

result = f - i
print("3.14 - 10 = " + result.toString())

// Test 2: String concatenation with numbers
print("\n=== String Concatenation Tests ===")
local text, num, boolVal
text = "Value: "
num = 42
boolVal = true

result = text + num
print("\"Value: \" + 42 = " + result)

result = text + f
print("\"Value: \" + 3.14 = " + result)

result = text + boolVal
print("\"Value: \" + true = " + result)

// Reverse concatenation
result = num + " items"
print("42 + \" items\" = " + result)

// Test 3: Cross-type comparisons
print("\n=== Cross-Type Comparison Tests ===")
local comparison

comparison = f > i
print("3.14 > 10: " + comparison.toString())

comparison = i > f
print("10 > 3.14: " + comparison.toString())

comparison = f < i
print("3.14 < 10: " + comparison.toString())

comparison = i < f
print("10 < 3.14: " + comparison.toString())

comparison = f >= i
print("3.14 >= 10: " + comparison.toString())

comparison = i <= f
print("10 <= 3.14: " + comparison.toString())

comparison = f == i
print("3.14 == 10: " + comparison.toString())

comparison = f != i
print("3.14 != 10: " + comparison.toString())

// Test 4: Complex expressions
print("\n=== Complex Expression Tests ===")
local complex

complex = (i + f) > 12
print("(10 + 3.14) > 12: " + complex.toString())

complex = (f * 2) < (i - 3)
print("(3.14 * 2) < (10 - 3): " + complex.toString())

complex = (i > 5) and (f > 3)
print("(10 > 5) and (3.14 > 3): " + complex.toString())

complex = (i < 5) or (f > 3)
print("(10 < 5) or (3.14 > 3): " + complex.toString())

// Test 5: Number to string auto-conversion in concatenation
print("\n=== Auto-Conversion Tests ===")
local auto1, auto2, auto3

auto1 = "Result: " + (i + f)
print("\"Result: \" + (10 + 3.14) = " + auto1)

auto2 = "Boolean: " + (i > f)
print("\"Boolean: \" + (10 > 3.14) = " + auto2)

auto3 = "Math: " + (f * f)
print("\"Math: \" + (3.14 * 3.14) = " + auto3)

print("\n✅ Cross-type operators Phase 1 tests completed!")