46 lines
1.6 KiB
Plaintext
46 lines
1.6 KiB
Plaintext
|
|
// Comprehensive test to verify Basic Box constructors work identically to literals
|
||
|
|
// This demonstrates that Problem 1 is fully resolved
|
||
|
|
|
||
|
|
local console = new ConsoleBox()
|
||
|
|
console.log("=== Comprehensive Basic Box Constructor Test ===")
|
||
|
|
|
||
|
|
// Test StringBox equivalence
|
||
|
|
local str_box = new StringBox("test")
|
||
|
|
local str_literal = "test"
|
||
|
|
console.log("StringBox toString: " + str_box.toString())
|
||
|
|
console.log("String literal: " + str_literal)
|
||
|
|
console.log("StringBox == literal: " + (str_box.toString() == str_literal))
|
||
|
|
|
||
|
|
console.log("---")
|
||
|
|
|
||
|
|
// Test IntegerBox equivalence
|
||
|
|
local int_box = new IntegerBox(123)
|
||
|
|
local int_literal = 123
|
||
|
|
console.log("IntegerBox toString: " + int_box.toString())
|
||
|
|
console.log("Integer literal: " + int_literal)
|
||
|
|
console.log("IntegerBox == literal: " + (int_box.toString() == int_literal.toString()))
|
||
|
|
|
||
|
|
console.log("---")
|
||
|
|
|
||
|
|
// Test BoolBox equivalence
|
||
|
|
local bool_box = new BoolBox(true)
|
||
|
|
local bool_literal = true
|
||
|
|
console.log("BoolBox toString: " + bool_box.toString())
|
||
|
|
console.log("Bool literal: " + bool_literal)
|
||
|
|
console.log("BoolBox == literal: " + (bool_box.toString() == bool_literal.toString()))
|
||
|
|
|
||
|
|
console.log("---")
|
||
|
|
|
||
|
|
// Test type conversion capabilities
|
||
|
|
local str_from_int = new StringBox(456)
|
||
|
|
console.log("StringBox from int: " + str_from_int.toString())
|
||
|
|
|
||
|
|
local int_from_str = new IntegerBox("789")
|
||
|
|
console.log("IntegerBox from string: " + int_from_str.toString())
|
||
|
|
|
||
|
|
local bool_from_str_true = new BoolBox("true")
|
||
|
|
local bool_from_str_false = new BoolBox("false")
|
||
|
|
console.log("BoolBox from 'true': " + bool_from_str_true.toString())
|
||
|
|
console.log("BoolBox from 'false': " + bool_from_str_false.toString())
|
||
|
|
|
||
|
|
console.log("=== All Basic Box Constructors Working! ===")
|