forked from TrueCloudLab/frostfs-node
[#542] Update test for SizeInBytesSafe
function
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
9ca63ac8c3
commit
ec8a631d31
3 changed files with 19 additions and 4 deletions
|
@ -125,10 +125,15 @@ func TestSizeInBytes(t *testing.T) {
|
||||||
)
|
)
|
||||||
configtest.ForEachFileType("test/config", func(c *config.Config) {
|
configtest.ForEachFileType("test/config", func(c *config.Config) {
|
||||||
c = c.Sub("sizes")
|
c = c.Sub("sizes")
|
||||||
|
require.EqualValues(t, 1, config.SizeInBytesSafe(c, "size_b"))
|
||||||
|
require.EqualValues(t, kb, config.SizeInBytesSafe(c, "size_k"))
|
||||||
require.EqualValues(t, kb, config.SizeInBytesSafe(c, "size_kb"))
|
require.EqualValues(t, kb, config.SizeInBytesSafe(c, "size_kb"))
|
||||||
require.EqualValues(t, 2*kb, config.SizeInBytesSafe(c, "size_kb_no_space"))
|
require.EqualValues(t, 2*kb, config.SizeInBytesSafe(c, "size_kb_no_space"))
|
||||||
|
require.EqualValues(t, 12*mb, config.SizeInBytesSafe(c, "size_m"))
|
||||||
require.EqualValues(t, 12*mb, config.SizeInBytesSafe(c, "size_mb"))
|
require.EqualValues(t, 12*mb, config.SizeInBytesSafe(c, "size_mb"))
|
||||||
|
require.EqualValues(t, 4*gb, config.SizeInBytesSafe(c, "size_g"))
|
||||||
require.EqualValues(t, 4*gb, config.SizeInBytesSafe(c, "size_gb"))
|
require.EqualValues(t, 4*gb, config.SizeInBytesSafe(c, "size_gb"))
|
||||||
|
require.EqualValues(t, 5*tb, config.SizeInBytesSafe(c, "size_t"))
|
||||||
require.EqualValues(t, 5*tb, config.SizeInBytesSafe(c, "size_tb"))
|
require.EqualValues(t, 5*tb, config.SizeInBytesSafe(c, "size_tb"))
|
||||||
require.EqualValues(t, 12, config.SizeInBytesSafe(c, "size_i_am_not_very_clever"))
|
require.EqualValues(t, 12, config.SizeInBytesSafe(c, "size_i_am_not_very_clever"))
|
||||||
require.EqualValues(t, tb/2, config.SizeInBytesSafe(c, "size_float"))
|
require.EqualValues(t, tb/2, config.SizeInBytesSafe(c, "size_float"))
|
||||||
|
|
|
@ -49,10 +49,15 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"sizes": {
|
"sizes": {
|
||||||
|
"size_b": "1b",
|
||||||
|
"size_k": "1 k",
|
||||||
"size_kb": "1 kb",
|
"size_kb": "1 kb",
|
||||||
"size_kb_no_space": "2kb",
|
"size_kb_no_space": "2kb",
|
||||||
"size_mb": "12m",
|
"size_m": "12m",
|
||||||
"size_gb": "4g",
|
"size_mb": "12mb",
|
||||||
|
"size_g": "4g",
|
||||||
|
"size_gb": "4gb",
|
||||||
|
"size_t": "5 T",
|
||||||
"size_tb": "5 TB",
|
"size_tb": "5 TB",
|
||||||
"size_float": ".5t",
|
"size_float": ".5t",
|
||||||
"size_float_big": "14.123 gb",
|
"size_float_big": "14.123 gb",
|
||||||
|
|
|
@ -42,10 +42,15 @@ bool:
|
||||||
incorrect: not true
|
incorrect: not true
|
||||||
|
|
||||||
sizes:
|
sizes:
|
||||||
|
size_b: 1b
|
||||||
|
size_k: 1 k
|
||||||
size_kb: 1 kb
|
size_kb: 1 kb
|
||||||
size_kb_no_space: 2kb
|
size_kb_no_space: 2kb
|
||||||
size_mb: 12m
|
size_m: 12m
|
||||||
size_gb: 4g
|
size_mb: 12mb
|
||||||
|
size_g: 4g
|
||||||
|
size_gb: 4gb
|
||||||
|
size_t: 5 T
|
||||||
size_tb: 5 TB
|
size_tb: 5 TB
|
||||||
size_float: .5t
|
size_float: .5t
|
||||||
size_float_big: 14.123 gb
|
size_float_big: 14.123 gb
|
||||||
|
|
Loading…
Reference in a new issue