61 lines
1.5 KiB
Plaintext
61 lines
1.5 KiB
Plaintext
# 🔥 Phase 8.8: pack透明化システム 最終統合テスト
|
||
# 全機能の協調動作確認
|
||
|
||
print("=== pack透明化システム最終統合テスト開始 ===")
|
||
|
||
# 1. 従来のbirth機能(ユーザー定義Box)
|
||
box Animal {
|
||
init { name, species }
|
||
|
||
birth(animalName, animalSpecies) {
|
||
me.name = animalName
|
||
me.species = animalSpecies
|
||
}
|
||
|
||
introduce() {
|
||
return me.name + " は " + me.species + " です"
|
||
}
|
||
}
|
||
|
||
# 2. pack透明化(ビルトインBox継承)
|
||
box SmartString from StringBox {
|
||
init { metadata }
|
||
|
||
birth(content, meta) {
|
||
from StringBox(content) # 透明化
|
||
me.metadata = meta
|
||
}
|
||
|
||
getInfo() {
|
||
return "内容の情報: " + me.metadata
|
||
}
|
||
}
|
||
|
||
# 3. 複数のビルトインBox透明化
|
||
box Calculator from MathBox {
|
||
init { precision }
|
||
|
||
birth(precisionLevel) {
|
||
from MathBox.birth() # Explicit syntax after Phase 8.9
|
||
me.precision = precisionLevel
|
||
}
|
||
|
||
getPrecision() {
|
||
return "精度: " + me.precision
|
||
}
|
||
}
|
||
|
||
# テスト実行
|
||
print("1. ユーザー定義Box:")
|
||
local cat = new Animal("ミケ", "猫")
|
||
print(cat.introduce())
|
||
|
||
print("2. StringBox透明化:")
|
||
local smartStr = new SmartString("Hello World", "UTF-8")
|
||
print(smartStr.getInfo())
|
||
|
||
print("3. MathBox透明化:")
|
||
local calc = new Calculator("高精度")
|
||
print(calc.getPrecision())
|
||
|
||
print("=== 全テスト成功!pack透明化システム完了 ===")テム完了 ===") |