# 2007 November 23
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file runs all tests.
#
# $Id: fts3.test,v 1.2 2008/07/23 18:17:32 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix fts3varint

ifcapable !fts3 {
  finish_test
  return
}

proc test_list {list} {
  foreach n $list { fts3_test_varint $n }
}

proc do_fts3_varint_test {tn list} {
  uplevel [list do_test $tn [list test_list $list] {}]
}

do_fts3_varint_test 1.0 {
  1 10 100 1000 10000 100000 1000000 
  10000000 100000000 1000000000 10000000000
  100000000000 1000000000000 10000000000000
}

do_fts3_varint_test 1.1 {
  -1 -10 -100 -1000 -10000 -100000 -1000000 
  -10000000 -100000000 -1000000000 -10000000000
  -100000000000 -1000000000000 -10000000000000
}

do_fts3_varint_test 2.0 { 0 1 2 }
do_fts3_varint_test 2.1 { 1 2 3 }
do_fts3_varint_test 2.2 { 3 4 5 }
do_fts3_varint_test 2.3 { 7 8 9 }
do_fts3_varint_test 2.4 { 15 16 17 }
do_fts3_varint_test 2.5 { 31 32 33 }
do_fts3_varint_test 2.6 { 63 64 65 }
do_fts3_varint_test 2.7 { 127 128 129 }
do_fts3_varint_test 2.8 { 255 256 257 }
do_fts3_varint_test 2.9 { 511 512 513 }
do_fts3_varint_test 2.10 { 1023 1024 1025 }
do_fts3_varint_test 2.11 { 2047 2048 2049 }
do_fts3_varint_test 2.12 { 4095 4096 4097 }
do_fts3_varint_test 2.13 { 8191 8192 8193 }
do_fts3_varint_test 2.14 { 16383 16384 16385 }
do_fts3_varint_test 2.15 { 32767 32768 32769 }
do_fts3_varint_test 2.16 { 65535 65536 65537 }
do_fts3_varint_test 2.17 { 131071 131072 131073 }
do_fts3_varint_test 2.18 { 262143 262144 262145 }
do_fts3_varint_test 2.19 { 524287 524288 524289 }
do_fts3_varint_test 2.20 { 1048575 1048576 1048577 }
do_fts3_varint_test 2.21 { 2097151 2097152 2097153 }
do_fts3_varint_test 2.22 { 4194303 4194304 4194305 }
do_fts3_varint_test 2.23 { 8388607 8388608 8388609 }
do_fts3_varint_test 2.24 { 16777215 16777216 16777217 }
do_fts3_varint_test 2.25 { 33554431 33554432 33554433 }
do_fts3_varint_test 2.26 { 67108863 67108864 67108865 }
do_fts3_varint_test 2.27 { 134217727 134217728 134217729 }
do_fts3_varint_test 2.28 { 268435455 268435456 268435457 }
do_fts3_varint_test 2.29 { 536870911 536870912 536870913 }
do_fts3_varint_test 2.30 { 1073741823 1073741824 1073741825 }
do_fts3_varint_test 2.31 { 2147483647 2147483648 2147483649 }
do_fts3_varint_test 2.32 { 4294967295 4294967296 4294967297 }
do_fts3_varint_test 2.33 { 8589934591 8589934592 8589934593 }
do_fts3_varint_test 2.34 { 17179869183 17179869184 17179869185 }
do_fts3_varint_test 2.35 { 34359738367 34359738368 34359738369 }
do_fts3_varint_test 2.36 { 68719476735 68719476736 68719476737 }
do_fts3_varint_test 2.37 { 137438953471 137438953472 137438953473 }
do_fts3_varint_test 2.38 { 274877906943 274877906944 274877906945 }
do_fts3_varint_test 2.39 { 549755813887 549755813888 549755813889 }
do_fts3_varint_test 2.40 { 1099511627775 1099511627776 1099511627777 }
do_fts3_varint_test 2.41 { 2199023255551 2199023255552 2199023255553 }
do_fts3_varint_test 2.42 { 4398046511103 4398046511104 4398046511105 }
do_fts3_varint_test 2.43 { 8796093022207 8796093022208 8796093022209 }
do_fts3_varint_test 2.44 { 17592186044415 17592186044416 17592186044417 }
do_fts3_varint_test 2.45 { 35184372088831 35184372088832 35184372088833 }
do_fts3_varint_test 2.46 { 70368744177663 70368744177664 70368744177665 }
do_fts3_varint_test 2.47 { 140737488355327 140737488355328 140737488355329 }
do_fts3_varint_test 2.48 { 281474976710655 281474976710656 281474976710657 }
do_fts3_varint_test 2.49 { 562949953421311 562949953421312 562949953421313 }
do_fts3_varint_test 2.50 { 1125899906842623 1125899906842624 1125899906842625 }
do_fts3_varint_test 2.51 { 2251799813685247 2251799813685248 2251799813685249 }
do_fts3_varint_test 2.52 { 4503599627370495 4503599627370496 4503599627370497 }
do_fts3_varint_test 2.53 { 9007199254740991 9007199254740992 9007199254740993 }
do_fts3_varint_test 2.54 { 
    18014398509481983 18014398509481984 18014398509481985 }
do_fts3_varint_test 2.55 { 
    36028797018963967 36028797018963968 36028797018963969 }
do_fts3_varint_test 2.56 { 
    72057594037927935 72057594037927936 72057594037927937 }
do_fts3_varint_test 2.57 { 
    144115188075855871 144115188075855872 144115188075855873 }
do_fts3_varint_test 2.58 { 
    288230376151711743 288230376151711744 288230376151711745 }
do_fts3_varint_test 2.59 { 
    576460752303423487 576460752303423488 576460752303423489 }
do_fts3_varint_test 2.60 { 
    1152921504606846975 1152921504606846976 1152921504606846977 }
do_fts3_varint_test 2.61 { 
    2305843009213693951 2305843009213693952 2305843009213693953 }
do_fts3_varint_test 2.62 { 
    4611686018427387903 4611686018427387904 4611686018427387905 }

if {![catch {fts3_test_varint 18446744073709551615}]} {
  do_fts3_varint_test 2.63 { 
      9223372036854775807 9223372036854775808 9223372036854775809 }

  do_fts3_varint_test 3.0 { 18446744073709551615 -18446744073709551615 }
}

finish_test