fork download
  1. require 'minitest/autorun'
  2.  
  3. f=->n{r=a=[]
  4. (0...n).map{|i|a<<a=[i]}
  5. r[0]||r}
  6.  
  7.  
  8. describe '#f' do
  9. it 'returns the correct results' do
  10. assert_equal f[0], []
  11. assert_equal f[1], [0]
  12. assert_equal f[2], [0, [1]]
  13. assert_equal f[6], [0, [1, [2, [3, [4, [5]]]]]]
  14. assert_equal f[26], [0, [1, [2, [3, [4, [5, [6, [7, [8, [9, [10, [11, [12, [13, [14, [15, [16, [17, [18, [19, [20, [21, [22, [23, [24, [25]]]]]]]]]]]]]]]]]]]]]]]]]]
  15. assert_equal f[69], [0, [1, [2, [3, [4, [5, [6, [7, [8, [9, [10, [11, [12, [13, [14, [15, [16, [17, [18, [19, [20, [21, [22, [23, [24, [25, [26, [27, [28, [29, [30, [31, [32, [33, [34, [35, [36, [37, [38, [39, [40, [41, [42, [43, [44, [45, [46, [47, [48, [49, [50, [51, [52, [53, [54, [55, [56, [57, [58, [59, [60, [61, [62, [63, [64, [65, [66, [67, [68]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
  16. end
  17. end
Success #stdin #stdout 0.05s 8592KB
stdin
Standard input is empty
stdout
Run options: --seed 7912

# Running tests:

.

Finished tests in 0.000770s, 1298.9510 tests/s, 7793.7058 assertions/s.

1 tests, 6 assertions, 0 failures, 0 errors, 0 skips