1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-11-13 11:04:27 -05:00

mruby: fix code style

This commit is contained in:
Alex Kotov 2022-05-30 13:02:16 +03:00
parent 2129255b5a
commit 2290fce88b
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 22 additions and 64 deletions

View file

@ -45,6 +45,10 @@ Style/FrozenStringLiteralComment:
Style/HashAsLastArrayItem:
Enabled: false
Style/NumericPredicate:
# Numeric#negative? is not available in mruby
Enabled: false
Style/PerlBackrefs:
Enabled: false

View file

@ -1,89 +1,43 @@
def common_assert(expected, result)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
end
def test_utoa(number, base, expected)
result = KernAux.utoa(number, base)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
result = KernAux.utoa(number, base, nil)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
result = KernAux.utoa(number, base, '')
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
common_assert expected, KernAux.utoa(number, base)
common_assert expected, KernAux.utoa(number, base, nil)
common_assert expected, KernAux.utoa(number, base, '')
end
def test_itoa(number, base, expected)
result = KernAux.itoa(number, base)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
result = KernAux.itoa(number, base, nil)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
result = KernAux.itoa(number, base, '')
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
common_assert expected, KernAux.itoa(number, base)
common_assert expected, KernAux.itoa(number, base, nil)
common_assert expected, KernAux.itoa(number, base, '')
end
def test_utoax(number, base, prefix, expected)
result = KernAux.utoa(number, base, prefix)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
common_assert expected, KernAux.utoa(number, base, prefix)
end
def test_itoax(number, base, prefix, expected)
result = KernAux.itoa(number, base, prefix)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
common_assert expected, KernAux.itoa(number, base, prefix)
end
def test_utoa10(number, expected)
result = KernAux.utoa10(number)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
common_assert expected, KernAux.utoa10(number)
end
def test_itoa10(number, expected)
result = KernAux.itoa10(number)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
common_assert expected, KernAux.itoa10(number)
end
def test_utoa16(number, expected)
result = KernAux.utoa16(number)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
common_assert expected, KernAux.utoa16(number)
end
def test_itoa16(number, expected)
result = KernAux.itoa16(number)
assert_true result.instance_of? String
assert_true result.frozen?
assert_equal expected, result
common_assert expected, KernAux.itoa16(number)
end
assert 'KernAux.utoa' do