| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
モジュール:Utility/StringBuilder/testcases
ナビゲーションに移動
検索に移動
このモジュールについての説明文ページを モジュール:Utility/StringBuilder/testcases/doc に作成できます
local p = {}
local StringBuilder = require('Module:Utility/StringBuilder')
local TestHelper = require('Module:Utility/TestHelper')
-- 単純なテスト
local function test()
local builder = StringBuilder.new()
builder:append('test')
return tostring(builder)
end
-- IFでtrueなテスト
local function testTrue()
local builder = StringBuilder.new()
builder:appendIf(true, 'true')
return tostring(builder)
end
-- IFでfalseなテスト
local function testFalse()
local builder = StringBuilder.new()
builder:appendIf(false, 'false')
return tostring(builder)
end
-- 複数の引数を持つ場合のテスト
local function testMultiple()
local builder = StringBuilder.new()
builder:append('test', 2, ' <- this is number')
return tostring(builder)
end
-- 文字列をフォーマットする場合のテスト
local function testFormat()
local builder = StringBuilder.new()
builder:appendFormat('%s: %d', 'count', 42)
return tostring(builder)
end
-- テスト結果
function p.result()
local testcases = {
['単純なテスト'] = {
func = test,
expected = 'test',
},
['IFでtrueなテスト'] = {
func = testTrue,
expected = 'true',
},
['IFでfalseなテスト'] = {
func = testFalse,
expected = '',
},
['複数の引数を持つ場合のテスト'] = {
func = testMultiple,
expected = 'test2 <- this is number',
},
['文字列をフォーマットする場合のテスト'] = {
func = testFormat,
expected = 'count: 42',
},
}
return TestHelper.executeAsNode(testcases)
end
-- エントリーポイント
function p.main()
return tostring(p.result())
end
return p