SRC_DIR = '../../../../src/database/impl/iterate/'

ByteIterableUtil =
  (require SRC_DIR + 'ByteIterableUtil.coffee').ByteIterableUtil

exports.testCompare = (test) ->
  test.expect 10
  a = new Buffer "TestNumber1"
  b = new Buffer "TestNumber2"
  c = new Buffer "Number1"
  d = new Buffer "Number111"
  test.equal (ByteIterableUtil.compare$Buffer$int$Buffer$int a, 11, b, 11), -1
  test.equal (ByteIterableUtil.compare$Buffer$int$Buffer$int b, 11, a, 11), 1
  test.equal (ByteIterableUtil.compare$Buffer$int$Buffer$int a, 10, b, 10), 0
  test.equal (ByteIterableUtil.compare$Buffer$int$int$Buffer$int a, 11, 4, c, 7), 0
  test.equal (ByteIterableUtil.compare$Buffer$int$int$Buffer$int b, 10, 4, c, 6), 0
  test.equal (ByteIterableUtil.compare$Buffer$int$int$Buffer$int b, 11, 4, c, 7), 1
  test.equal (ByteIterableUtil.compare$Buffer$int$Buffer$int c, 7, d, 9), -2
  test.equal (ByteIterableUtil.compare$Buffer$int$Buffer$int c, 7, d, 7), 0
  test.equal (ByteIterableUtil.compare$Buffer$int$Buffer$int a, 11, c, 7), 6
  test.equal (ByteIterableUtil.compare$Buffer$int$Buffer$int b, 11, d, 9), 6
  test.done()