// 🧪 新しいBoxタイプの統合テスト
// Arc<Mutex>パターンが正しく動作することを確認

print("=== New Boxes Integration Test ===")

// 📦 ArrayBox Test
print("\n🔹 ArrayBox Test:")
local arr
arr = new ArrayBox()
arr.push("Hello")
arr.push("World") 
arr.push(42)
print("Array length: " + arr.length())
print("Array contents: " + arr.toString())

// 🗄️ MapBox Test  
print("\n🔹 MapBox Test:")
local map
map = new MapBox()
map.set("name", "Alice")
map.set("age", 25)
map.set("active", true)
print("Map size: " + map.size())
print("Name: " + map.get("name"))
print("Age: " + map.get("age"))
print("Has email: " + map.has("email"))

// 📊 BufferBox Test
print("\n🔹 BufferBox Test:")
local buffer
buffer = new BufferBox()
local data_array
data_array = new ArrayBox()
data_array.push(72)  // H
data_array.push(101) // e
data_array.push(108) // l
data_array.push(108) // l
data_array.push(111) // o
buffer.write(data_array)
print("Buffer size: " + buffer.length())

// 🔍 RegexBox Test  
print("\n🔹 RegexBox Test:")
local regex
regex = new RegexBox("[0-9]+")
print("Regex pattern: " + regex.pattern())
print("Test '123': " + regex.test("123"))
print("Test 'abc': " + regex.test("abc"))

// ✅ ResultBox Test
print("\n🔹 ResultBox Test:")
local ok_result, err_result
ok_result = new ResultBox()
ok_result = ResultBox.ok("Success!")
print("OK result: " + ok_result.toString())
print("Is OK: " + ok_result.is_ok())

print("\n🎉 All Arc<Mutex> pattern tests completed successfully!")