diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
commit | be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /web/server/h2o/libh2o/deps/mruby/mrbgems/mruby-range-ext/test | |
parent | Initial commit. (diff) | |
download | netdata-be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97.tar.xz netdata-be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97.zip |
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/server/h2o/libh2o/deps/mruby/mrbgems/mruby-range-ext/test')
-rw-r--r-- | web/server/h2o/libh2o/deps/mruby/mrbgems/mruby-range-ext/test/range.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/deps/mruby/mrbgems/mruby-range-ext/test/range.rb b/web/server/h2o/libh2o/deps/mruby/mrbgems/mruby-range-ext/test/range.rb new file mode 100644 index 00000000..efcbdabe --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby/mrbgems/mruby-range-ext/test/range.rb @@ -0,0 +1,32 @@ +## +# Range(Ext) Test + +assert('Range#cover?') do + assert_true ("a".."z").cover?("c") + assert_true !("a".."z").cover?("5") + assert_true ("a".."z").cover?("cc") +end + +assert('Range#first') do + assert_equal 10, (10..20).first + assert_equal [10, 11, 12], (10..20).first(3) + assert_equal [0, 1, 2], (0..Float::INFINITY).first(3) +end + +assert('Range#last') do + assert_equal 20, (10..20).last + assert_equal 20, (10...20).last + assert_equal [18, 19, 20], (10..20).last(3) + assert_equal [17, 18, 19], (10...20).last(3) +end + +assert('Range#size') do + assert_equal 42, (1..42).size + assert_equal 41, (1...42).size + assert_equal 6, (1...6.3).size + assert_equal 5, (1...6.0).size + assert_equal 5, (1.1...6).size + assert_equal 15, (1.0..15.9).size + assert_equal Float::INFINITY, (0..Float::INFINITY).size + assert_nil ('a'..'z').size +end |