t / t0080-vcs-svn.shon commit Merge branch 'jk/maint-config-param' (fe01ef3)
   1#!/bin/sh
   2
   3test_description='check infrastructure for svn importer'
   4
   5. ./test-lib.sh
   6uint32_max=4294967295
   7
   8test_expect_success 'obj pool: store data' '
   9        cat <<-\EOF >expected &&
  10        0
  11        1
  12        EOF
  13
  14        test-obj-pool <<-\EOF >actual &&
  15        alloc one 16
  16        set one 13
  17        test one 13
  18        reset one
  19        EOF
  20        test_cmp expected actual
  21'
  22
  23test_expect_success 'obj pool: NULL is offset ~0' '
  24        echo "$uint32_max" >expected &&
  25        echo null one | test-obj-pool >actual &&
  26        test_cmp expected actual
  27'
  28
  29test_expect_success 'obj pool: out-of-bounds access' '
  30        cat <<-EOF >expected &&
  31        0
  32        0
  33        $uint32_max
  34        $uint32_max
  35        16
  36        20
  37        $uint32_max
  38        EOF
  39
  40        test-obj-pool <<-\EOF >actual &&
  41        alloc one 16
  42        alloc two 16
  43        offset one 20
  44        offset two 20
  45        alloc one 5
  46        offset one 20
  47        free one 1
  48        offset one 20
  49        reset one
  50        reset two
  51        EOF
  52        test_cmp expected actual
  53'
  54
  55test_expect_success 'obj pool: high-water mark' '
  56        cat <<-\EOF >expected &&
  57        0
  58        0
  59        10
  60        20
  61        20
  62        20
  63        EOF
  64
  65        test-obj-pool <<-\EOF >actual &&
  66        alloc one 10
  67        committed one
  68        alloc one 10
  69        commit one
  70        committed one
  71        alloc one 10
  72        free one 20
  73        committed one
  74        reset one
  75        EOF
  76        test_cmp expected actual
  77'
  78
  79test_expect_success 'string pool' '
  80        echo a does not equal b >expected.differ &&
  81        echo a equals a >expected.match &&
  82        echo equals equals equals >expected.matchmore &&
  83
  84        test-string-pool "a,--b" >actual.differ &&
  85        test-string-pool "a,a" >actual.match &&
  86        test-string-pool "equals-equals" >actual.matchmore &&
  87        test_must_fail test-string-pool a,a,a &&
  88        test_must_fail test-string-pool a &&
  89
  90        test_cmp expected.differ actual.differ &&
  91        test_cmp expected.match actual.match &&
  92        test_cmp expected.matchmore actual.matchmore
  93'
  94
  95test_expect_success 'treap sort' '
  96        cat <<-\EOF >unsorted &&
  97        68
  98        12
  99        13
 100        13
 101        68
 102        13
 103        13
 104        21
 105        10
 106        11
 107        12
 108        13
 109        13
 110        EOF
 111        sort unsorted >expected &&
 112
 113        test-treap <unsorted >actual &&
 114        test_cmp expected actual
 115'
 116
 117test_done