59: def test_all_starts
60: starts = @sarray.all_starts "b"
61: assert_not_nil starts
62:
63: assert_equal starts.length, 2, "Wrong number of starts for 'b' of #@source"
64: assert_equal starts[0], @source.rindex("b"), "Index #{starts[0]} should be #{@source.rindex('b')}"
65: assert_equal starts[1], @source.index("b"), "Index #{starts[1]} should be #{@source.index('b')}"
66:
67: starts.each do |i|
68: assert_equal @source[i], "b"[0], "Character at starts index is not 'b' it's #{@source[i]}"
69: end
70:
71:
72: my_source = File.read("test/test_suffix_array.rb")
73: bigsa = SuffixArray.new(my_source)
74: starts = bigsa.all_starts(' ')
75:
76: starts.each do |i|
77: assert_equal my_source[i], ' '[0], "Invalid character at index (#{my_source[i]} != #{' '[0]})"
78: end
79: end