@@ -382,6 +382,59 @@ describe "Julia reference output compatibility" do
382382 p = UnicodePlot .histogram([0.1 _f32 , 0.1 _f32 , 0.0 _f32 ])
383383 test_ref(" histogram/float32.txt" , p)
384384 end
385+
386+ # The following cases reuse DENSITYPLOT_X which is identical to Julia's
387+ # `seed!(RNG, 1337); x = randn(RNG, 4000)` used in tst_histogram.jl.
388+
389+ it " matches histogram/default" do
390+ p = UnicodePlot .histogram(DENSITYPLOT_X )
391+ test_ref(" histogram/default.txt" , p)
392+ end
393+
394+ it " matches histogram/default_1e-2 (data scaled ×0.01)" do
395+ p = UnicodePlot .histogram(DENSITYPLOT_X .map { |v | v * 0.01 })
396+ test_ref(" histogram/default_1e-2.txt" , p)
397+ end
398+
399+ it " matches histogram/default_1e2 (data scaled ×100)" do
400+ p = UnicodePlot .histogram(DENSITYPLOT_X .map { |v | v * 100.0 })
401+ test_ref(" histogram/default_1e2.txt" , p)
402+ end
403+
404+ it " matches histogram/log10 (xscale: :log10)" do
405+ p = UnicodePlot .histogram(DENSITYPLOT_X , xscale: :log10 )
406+ test_ref(" histogram/log10.txt" , p)
407+ end
408+
409+ it " matches histogram/log10_label (xscale: :log10 with custom xlabel)" do
410+ p = UnicodePlot .histogram(DENSITYPLOT_X , xlabel: " custom label" , xscale: :log10 )
411+ test_ref(" histogram/log10_label.txt" , p)
412+ end
413+
414+ it " matches histogram/parameters1 (title, xlabel, color:blue, margin, padding)" do
415+ p = UnicodePlot .histogram(
416+ DENSITYPLOT_X ,
417+ title: " My Histogram" ,
418+ xlabel: " Absolute Frequency" ,
419+ color: :blue ,
420+ margin: 7 ,
421+ padding: 3 ,
422+ )
423+ test_ref(" histogram/parameters1.txt" , p)
424+ end
425+
426+ it " matches histogram/parameters2 (title, color:yellow, border:solid, symbols:[=], width:50)" do
427+ p = UnicodePlot .histogram(
428+ DENSITYPLOT_X ,
429+ title: " My Histogram" ,
430+ xlabel: " Absolute Frequency" ,
431+ color: :yellow ,
432+ border: :solid ,
433+ symbols: ['=' ],
434+ width: 50 ,
435+ )
436+ test_ref(" histogram/parameters2.txt" , p)
437+ end
385438 end
386439
387440 describe " boxplot" do
0 commit comments