Phase 8.8: Pack transparency system completed - All requirements implemented and tested
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
This commit is contained in:
61
test_pack_transparency_final.nyash
Normal file
61
test_pack_transparency_final.nyash
Normal file
@ -0,0 +1,61 @@
|
||||
# 🔥 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() # 透明化(引数なし)
|
||||
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透明化システム完了 ===")
|
||||
Reference in New Issue
Block a user