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,26 @@
covers 'facets/numeric/approx'
test_case Numeric do
method :approx? do
test do
f = 10.006
assert( f.approx?(10, 0.1) )
assert( 100.4.approx?(100.6, 1) )
end
end
method :close? do
test do
f = 10.006
assert( f.close?(10, 0.1) )
assert( 100.4.close?(100.6, 1) )
end
end
end
@@ -0,0 +1,68 @@
covers 'facets/numeric/delimit'
test_case Numeric do
f0 = [ 0, 100, 1_000, 1_000_000 ]
method :delimit do
test "commas are default" do
fr = f0.map { |f| f.delimit }
fr.assert == %w( 0 100 1,000 1,000,000 )
end
test "delimiter can be anything" do
fr = f0.map { |f| f.delimit(:delimiter => "_") }
fr.assert == %w( 0 100 1_000 1_000_000 )
end
test "separator defaults to dot" do
fr = f0.map { |f| ( f + 0.1 ).delimit }
fr.assert == %w( 0.1 100.1 1,000.1 1,000,000.1 )
end
test "separator can be anything" do
fr = f0.map { |f| ( f + 0.1 ).delimit(:separator => "!") }
fr.assert == %w( 0!1 100!1 1,000!1 1,000,000!1 )
end
end
end
=begin
test_case Float do
f1 = [ 10.1, 10.01, 10.9, 10.09, 10.5, 10.05, 10.49 ]
# method :round_at do
#
# test "1" do
# fr = f1.collect { |f| f.round_at(1) }
# fr.assert == [10.1,10.0,10.9,10.1,10.5,10.1,10.5]
# end
#
# test "2" do
# fr = f1.collect { |f| f.round_at(2) }
# fr.assert == [10.1,10.01,10.9,10.09,10.5,10.05,10.49]
# end
#
# end
method :round_to do
test "0.1" do
fr = f1.collect { |f| f.round_to(0.1) }
fr.assert == [10.1,10.0,10.9,10.1,10.5,10.1,10.5]
end
test "10" do
fr = f1.collect { |f| f.round_to(10) }
fr.assert == [10,10,10,10,10,10,10]
end
end
end
=end
@@ -0,0 +1,16 @@
covers 'facets/numeric/distance'
test_case Numeric do
method :distance do
test do
10.distance(6).assert == 4
10.distance(8).assert == 2
7.distance(9).assert == -2
end
end
end
@@ -0,0 +1,16 @@
covers 'facets/numeric/length'
test_case Numeric do
method :length do
test do
(0..10).each do |power|
power.length.assert == power
end
end
end
end
@@ -0,0 +1,76 @@
covers 'facets/numeric/round_to'
test_case Numeric do
f0 = [ 0, 10, 15, 105 ]
# method :round_at do
#
# test "1" do
# fr = f0.collect{ |f| f.round_at(1) }
# fr.assert == [0,10,15,105]
# end
#
# test "2" do
# fr = f0.collect { |f| f.round_at(2) }
# fr.assert == [0,10,15,105]
# end
#
# end
method :round_to do
test "0.1" do
fr = f0.collect { |f| f.round_to(0.1) }
fr.assert == [0,10,15,105]
end
test "10" do
fr = f0.collect { |f| f.round_to(10) }
fr.assert == [0,10,20,110]
end
end
#method :round_off do
# test do
# 1.2.round_off.assert == 1.0
# 1.8.round_off.assert == 2.0
# end
#end
end
test_case Float do
f1 = [ 10.1, 10.01, 10.9, 10.09, 10.5, 10.05, 10.49 ]
# method :round_at do
#
# test "1" do
# fr = f1.collect { |f| f.round_at(1) }
# fr.assert == [10.1,10.0,10.9,10.1,10.5,10.1,10.5]
# end
#
# test "2" do
# fr = f1.collect { |f| f.round_at(2) }
# fr.assert == [10.1,10.01,10.9,10.09,10.5,10.05,10.49]
# end
#
# end
method :round_to do
test "0.1" do
fr = f1.collect { |f| f.round_to(0.1) }
fr.assert == [10.1,10.0,10.9,10.1,10.5,10.1,10.5]
end
test "10" do
fr = f1.collect { |f| f.round_to(10) }
fr.assert == [10,10,10,10,10,10,10]
end
end
end
@@ -0,0 +1,17 @@
covers 'facets/numeric/spacing'
test_case Numeric do
method :spacing do
test do
samples = [-10.5, -3, 3, 1.0e14, 10000, 14.5e10]
samples.each do |numeric_item|
numeric_item.spacing.assert == numeric_item.to_s.size
numeric_item.spacing.assert.kind_of?(Integer)
end
end
end
end