// P2Pの要素を段階的にテスト print("=== P2P Elements Test ===") // Element 1: MapBox操作 print("Test 1: MapBox operations") local map map = new MapBox() map.set("hello", "Alice") local value value = map.get("hello") print("Got value: " + value) // Element 2: 存在しないキーのアクセス print("Test 2: Non-existent key") local missing missing = map.get("nonexistent") print("Missing value is: " + missing) // Element 3: if文での比較 print("Test 3: If comparison") if (missing == "something") { print("This should not print") } else { print("Else branch worked") } // Element 4: Box間の相互参照 print("Test 4: Box references") box SimpleNode { init { name, messageBox } setName(n) { me.name = n } setMessageBox(m) { me.messageBox = m } sendTo(type, data) { print("Sending: " + type + " = " + data) } } local node node = new SimpleNode() node.setName("TestNode") node.sendTo("test", "data") print("All elements test completed!")