## 🎯 主要な変更 - ArrayBoxをArc<Mutex>パターンで完全再実装 - 全メソッドが`&self`で統一(push, pop, get, set等) - Box<dyn NyashBox>引数対応でNyashから使用可能に ## ✨ 修正内容 - ArrayBox: 完全なArc<Mutex>実装に置き換え - BufferBox: ArrayBoxとの連携修正、デバッグ出力削除 - StringBox: 新しいArrayBoxインポートに修正 - RandomBox: 新しいArrayBoxインポートに修正 - box_trait.rs: 古いArrayBox定義を削除しre-export追加 ## 🧪 テスト追加 - test_buffer_box.nyash: BufferBox動作確認 - test_random_box.nyash: RandomBox動作確認 - test_new_boxes.nyash: 包括的Box機能テスト修正 ## ✅ 確認済み動作 - ArrayBox: push/pop/get/set/join等全メソッド - BufferBox: write/readAll/length - RandomBox: choice/shuffle等配列操作 - JSONBox/RegexBox: 既に正しく実装済み 🚀 全Box型がArc<Mutex>パターンで統一完了! 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
656 B
Plaintext
32 lines
656 B
Plaintext
// 🎲 RandomBoxのテスト
|
|
|
|
print("=== RandomBox Test ===")
|
|
local random, result, array
|
|
|
|
// RandomBox作成
|
|
random = new RandomBox()
|
|
|
|
// 基本乱数テスト
|
|
result = random.random()
|
|
print("Random float: " + result)
|
|
|
|
result = random.randInt(1, 6)
|
|
print("Dice roll (1-6): " + result)
|
|
|
|
result = random.randBool()
|
|
print("Random bool: " + result)
|
|
|
|
// 配列テスト
|
|
array = new ArrayBox()
|
|
array.push("apple")
|
|
array.push("banana")
|
|
array.push("cherry")
|
|
|
|
result = random.choice(array)
|
|
print("Random choice: " + result)
|
|
|
|
// 文字列生成テスト
|
|
result = random.randString(5)
|
|
print("Random string (5 chars): " + result)
|
|
|
|
print("RandomBox test completed!") |