

require-macros:
   earl-mocha ->
      describe, it, before, after, before-each, after-each
      xdescribe, xit
      assert, asserts
      expect-error

require:
   ..src/util ->
      longest-run


test-lr{input, expected, cmp = {x, y} -> x < y, minimum = -1} =
   assert longest-run{input, cmp, minimum} == expected

describe "longest-run":
   it "test 1":
      test-lr{{1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}}
   it "test 2":
      test-lr{{1, 2, 9, 4, 5}, {1, 2, 4, 5}}
   it "test 3":
      test-lr{{9, 10, 1, 2, 3, 11}, {1, 2, 3, 11}}
   it "test 4":
      test-lr{{1, 10, 2, 11, 3, 12, 4}, {1, 2, 3, 4}}
   it "test 5":
      test-lr{{1, null, null, 2, 3}, {1, 2, 3}}
   it "test 6":
      test-lr{{5, 4, 3, 2, 1}, {1}}

   it "alternate compare":
      test-lr{{5, 4, 3, 2, 1}, {5, 4, 3, 2, 1}, {x, y} -> x > y, 1/0}

   ;; it "very long sequence":
   ;;    1..1000 each n ->
   ;;       start = +[new Date{}]
   ;;       a = 1..n each i -> Math.random{}
   ;;       b = 1..n each i -> i
   ;;       ;; test-lr{a, b}
   ;;       longest-run{a, {x, y} -> x < y, -1/0}
   ;;       end = +[new Date{}]
   ;;       print {n, [end - start] / n}



