Add bin and edit workflow
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s

This commit is contained in:
2026-09-16 13:11:16 -06:00
parent c8ac4fcae5
commit 4cee170d66
17576 changed files with 895740 additions and 2 deletions
@@ -0,0 +1,32 @@
covers 'facets/range/combine'
test_case Range do
method :combine do
test do
r = 0..4
r = r.combine(2..6, 6..10, 13..17, 12..19)
x = [0..10, 12..19]
r.assert == x
end
end
class_method :combine do
test do
r = Range.combine(0..4, 2..6, 6..10, 13..17, 12..19)
x = [0..10, 12..19]
r.assert == x
end
test "arrays as intervals" do
r = Range.combine([0, 4], [2, 6], [6, 10], [13, 17], [12, 19])
x = [[0, 10], [12, 19]]
r.assert == x
end
end
end
@@ -0,0 +1,32 @@
covers 'facets/range/nudge'
test_case Range do
method :nudge do
test 'default nudge' do
(17..32).nudge.assert == (18..33)
(17..32).nudge.nudge.assert == (19..34)
(17...32).nudge.assert == (18...33)
end
test 'positive nudge' do
(1..9).nudge(2).assert == (3..11)
(1...9).nudge(2).assert == (3...11)
end
test 'negative nudge' do
(5..6).nudge(-2).assert == (3..4)
(5...6).nudge(-2).assert == (3...4)
end
test 'min nudge' do
(5..9).nudge(:min => 2).assert == (7..9)
(5...9).nudge(:min => 2).assert == (7...9)
end
test 'max nudge' do
(8..16).nudge(:max => 10).assert == (8..26)
(8...16).nudge(:max => 10).assert == (8...26)
end
end
end
@@ -0,0 +1,24 @@
require 'facets/range/op_add'
test_case Range do
method :+ do
#test { lambda{ (1..10) + 'a' }.assert raise_error }
test { ((1..10) + (11..11)).assert == [1..11] }
test { ((1..10) + 12).assert == [1..10, 12] }
test { ((1..10) + (10..12)).assert == [1..12] }
test { ((1..10) + (11..12)).assert == [1..12] }
test { ((1..10) + (9..12)).assert == [1..12] }
test { ((1..10) + (1..12)).assert == [1..12] }
test { ((1..10) + (12..20)).assert == [1..10, 12..20] }
test { ((1..10) + 0).assert == [0..10] }
test { ((1..10) + -1).assert == [-1, 1..10] }
test { ((1..10) + (-10..-1)).assert == [-10..-1, 1..10] }
test { ((1..10) + (-10..0)).assert == [-10..10] }
test { ((1..10) + (-10..1)).assert == [-10..10] }
test { ((1..10) + (-10..2)).assert == [-10..10] }
test { ((1..10) + (-10..20)).assert == [-10..20]}
end
end
@@ -0,0 +1,34 @@
require 'facets/range/op_sub'
test_case Range do
method :- do
#test { lambda{ (1..10) - 'a' }.assert raise_error }
test { ((1..10) - (5..5)).assert == [1..4, 6..10] }
test { ((1..10) - 2).assert == [1, 3..10] }
test { ((1..10) - 9).assert == [1..8, 10] }
test { ((1..10) - 10).assert == [1..9, nil] }
test { ((1..10) - 1).assert == [nil, 2..10] }
test { ((1..10) - 11).assert == [1..10, nil] }
test { ((1..10) - 12).assert == [1..10, nil] }
test { ((1..10) - 0).assert == [nil, 1..10] }
test { ((1..10) - -1).assert == [nil, 1..10] }
test { ((1..10) - (4..6)).assert == [1..3, 7..10] }
test { ((1..10) - (2..6)).assert == [1, 7..10] }
test { ((1..10) - (4..9)).assert == [1..3, 10] }
test { ((1..10) - (2..9)).assert == [1, 10] }
test { ((1..10) - (2..11)).assert == [1] }
test { ((1..10) - (0..9)).assert == [10] }
test { ((1..10) - (4..10)).assert == [1..3] }
test { ((1..10) - (4..12)).assert == [1..3] }
test { ((1..10) - (1..6)).assert == [7..10] }
test { ((1..10) - (-2..6)).assert == [7..10] }
test { ((1..10) - (11..20)).assert == [1..10] }
test { ((1..10) - (-10..0)).assert == [1..10] }
test { ((1..10) - (-10..20)).assert == [] }
end
end
@@ -0,0 +1,15 @@
covers 'facets/range/overlap'
test_case Range do
method :overlap? do
test do
assert( (4..5).overlap?(3..6) )
assert(! (7..9).overlap?(3..6) )
end
end
end
@@ -0,0 +1,20 @@
covers 'facets/range/to_rng'
test_case Range do
method :to_rng do
test do
a = (0..10)
a.to_rng.assert == a
end
end
method :to_range do
test do
a = (0..10)
a.to_range.assert == a
end
end
end
@@ -0,0 +1,32 @@
covers 'facets/range/umbrella'
test_case Range do
method :umbrella do
test do
(3..6).umbrella(3..6).assert == [0,0]
(3...6).umbrella(3...6).assert == [0,0]
end
test "partially aligned" do
(3..6).umbrella(2..6).assert == [1,0]
(3..6).umbrella(3..7).assert == [0,1]
(3..6).umbrella(4..6).assert == [-1,0]
(3..6).umbrella(3..5).assert == [0,-1]
end
test "offset" do
(3..6).umbrella(2..7).assert == [1,1]
(3..6).umbrella(4..7).assert == [-1,1]
(3..6).umbrella(2..5).assert == [1,-1]
(3..6).umbrella(4..5).assert == [-1,-1]
end
test "offset by exclusion" do
(10...20).umbrella(10..20).assert == [0,1]
end
end
end
@@ -0,0 +1,25 @@
covers 'facets/range/within'
test_case Range do
method :within? do
test "wholy within range" do
assert( (4..5).within?(3..6) )
end
test "sentinals are equal" do
assert( (3..6).within?(3..6) )
end
test "lower sentinal out of range" do
assert(! (2..5).within?(3..6) )
end
test "upper sentinal out of range" do
assert(! (5..7).within?(3..6) )
end
end
end