Skip to content

Commit 998615a

Browse files
committed
Add regression specs for Int128/UInt128 inputs
1 parent 9caa88b commit 998615a

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

spec/unicode_plot_spec.cr

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ describe UnicodePlot do
5959
p.to_s.should be_a(String)
6060
end
6161

62+
it "accepts Int128 arrays via numeric overload" do
63+
p = UnicodePlot.lineplot([1_i128, 2_i128, 3_i128], [1_i128, 4_i128, 9_i128])
64+
p.to_s.should be_a(String)
65+
end
66+
6267
it "accepts mixed numeric x/y element types" do
6368
p = UnicodePlot.lineplot([1_i32, 2_i32, 3_i32], [1.0_f32, 4.0_f32, 9.0_f32])
6469
p.to_s.should be_a(String)
@@ -88,6 +93,13 @@ describe UnicodePlot do
8893
p.series.should eq(prev_series + 1)
8994
end
9095

96+
it "accepts y-only UInt128 overload in lineplot!" do
97+
p = UnicodePlot.lineplot([1_u128, 2_u128, 3_u128])
98+
prev_series = p.series
99+
UnicodePlot.lineplot!(p, [4_u128, 5_u128, 6_u128])
100+
p.series.should eq(prev_series + 1)
101+
end
102+
91103
it "ignores extreme finite values without overflowing during rasterization" do
92104
p = UnicodePlot.lineplot([Float64::MAX, 0.5], [0.5, 0.5])
93105
p.to_s.should be_a(String)
@@ -216,6 +228,11 @@ describe UnicodePlot do
216228
p = UnicodePlot.histogram([1, 2, 3, 2, 1])
217229
p.to_s.should be_a(String)
218230
end
231+
232+
it "accepts UInt128 arrays via generic numeric overload" do
233+
p = UnicodePlot.histogram([1_u128, 2_u128, 3_u128, 2_u128, 1_u128])
234+
p.to_s.should be_a(String)
235+
end
219236
end
220237

221238
describe "densityplot" do
@@ -348,6 +365,11 @@ describe UnicodePlot do
348365
p = UnicodePlot.heatmap([[1, 2], [3, 4]])
349366
p.to_s.should be_a(String)
350367
end
368+
369+
it "accepts Int128 matrix via generic numeric overload" do
370+
p = UnicodePlot.heatmap([[1_i128, 2_i128], [3_i128, 4_i128]])
371+
p.to_s.should be_a(String)
372+
end
351373
end
352374

353375
describe "stairs" do
@@ -367,6 +389,11 @@ describe UnicodePlot do
367389
p = UnicodePlot.stairs([1, 2, 3], [4, 5, 6])
368390
p.to_s.should be_a(String)
369391
end
392+
393+
it "accepts UInt128 arrays via generic numeric overload" do
394+
p = UnicodePlot.stairs([1_u128, 2_u128, 3_u128], [4_u128, 5_u128, 6_u128])
395+
p.to_s.should be_a(String)
396+
end
370397
end
371398

372399
describe "BrailleCanvas" do

0 commit comments

Comments
 (0)