1*9a7741deSElliott Hughesecho T.int-expr: test interval expressions 2*9a7741deSElliott Hughes 3*9a7741deSElliott Hughesawk=${awk-../a.out} 4*9a7741deSElliott Hughes 5*9a7741deSElliott Hughesrm -f foo 6*9a7741deSElliott Hughes 7*9a7741deSElliott Hughescat << \EOF > prog 8*9a7741deSElliott HughesNF == 0 { next } 9*9a7741deSElliott Hughes$1 == "pat" { pattern = $2; next } 10*9a7741deSElliott Hughes{ 11*9a7741deSElliott Hughes check = ($1 ~ pattern) 12*9a7741deSElliott Hughes printf("%s ~ /%s/ -> should be %d, is %d\n", $1, pattern, $2, check) 13*9a7741deSElliott Hughes} 14*9a7741deSElliott HughesEOF 15*9a7741deSElliott Hughes 16*9a7741deSElliott Hughescat << \EOF > foo.in 17*9a7741deSElliott Hughespat ab{0}c 18*9a7741deSElliott Hughesac 1 19*9a7741deSElliott Hughesabc 0 20*9a7741deSElliott Hughes 21*9a7741deSElliott Hughespat a(b{0})c 22*9a7741deSElliott Hughesac 1 23*9a7741deSElliott Hughesabc 0 24*9a7741deSElliott Hughes 25*9a7741deSElliott Hughespat ab{0}*c 26*9a7741deSElliott Hughesac 1 27*9a7741deSElliott Hughesabc 0 28*9a7741deSElliott Hughes 29*9a7741deSElliott Hughespat a(b{0})*c 30*9a7741deSElliott Hughesac 1 31*9a7741deSElliott Hughesabc 0 32*9a7741deSElliott Hughes 33*9a7741deSElliott Hughespat ab{0,}c 34*9a7741deSElliott Hughesac 1 35*9a7741deSElliott Hughesabc 1 36*9a7741deSElliott Hughes 37*9a7741deSElliott Hughespat a(b{0,})c 38*9a7741deSElliott Hughesac 1 39*9a7741deSElliott Hughesabc 1 40*9a7741deSElliott Hughes 41*9a7741deSElliott Hughespat ab{0,}*c 42*9a7741deSElliott Hughesac 1 43*9a7741deSElliott Hughesabc 1 44*9a7741deSElliott Hughes 45*9a7741deSElliott Hughespat a(b{0,})*c 46*9a7741deSElliott Hughesac 1 47*9a7741deSElliott Hughesabc 1 48*9a7741deSElliott Hughes 49*9a7741deSElliott Hughespat ab{1}c 50*9a7741deSElliott Hughesac 0 51*9a7741deSElliott Hughesabc 1 52*9a7741deSElliott Hughesabbc 0 53*9a7741deSElliott Hughes 54*9a7741deSElliott Hughespat ab{1,}c 55*9a7741deSElliott Hughesac 0 56*9a7741deSElliott Hughesabc 1 57*9a7741deSElliott Hughesabbc 1 58*9a7741deSElliott Hughesabbbc 1 59*9a7741deSElliott Hughesabbbbc 1 60*9a7741deSElliott Hughes 61*9a7741deSElliott Hughespat ab{0,1}c 62*9a7741deSElliott Hughesac 1 63*9a7741deSElliott Hughesabc 1 64*9a7741deSElliott Hughesabbc 0 65*9a7741deSElliott Hughes 66*9a7741deSElliott Hughespat ab{0,3}c 67*9a7741deSElliott Hughesac 1 68*9a7741deSElliott Hughesabc 1 69*9a7741deSElliott Hughesabbc 1 70*9a7741deSElliott Hughesabbbc 1 71*9a7741deSElliott Hughesabbbbc 0 72*9a7741deSElliott Hughes 73*9a7741deSElliott Hughespat ab{1,3}c 74*9a7741deSElliott Hughesac 0 75*9a7741deSElliott Hughesabc 1 76*9a7741deSElliott Hughesabbc 1 77*9a7741deSElliott Hughesabbbc 1 78*9a7741deSElliott Hughesabbbbc 0 79*9a7741deSElliott HughesEOF 80*9a7741deSElliott Hughes 81*9a7741deSElliott Hughescat << \EOF > foo1 82*9a7741deSElliott Hughesac ~ /ab{0}c/ -> should be 1, is 1 83*9a7741deSElliott Hughesabc ~ /ab{0}c/ -> should be 0, is 0 84*9a7741deSElliott Hughesac ~ /a(b{0})c/ -> should be 1, is 1 85*9a7741deSElliott Hughesabc ~ /a(b{0})c/ -> should be 0, is 0 86*9a7741deSElliott Hughesac ~ /ab{0}*c/ -> should be 1, is 1 87*9a7741deSElliott Hughesabc ~ /ab{0}*c/ -> should be 0, is 0 88*9a7741deSElliott Hughesac ~ /a(b{0})*c/ -> should be 1, is 1 89*9a7741deSElliott Hughesabc ~ /a(b{0})*c/ -> should be 0, is 0 90*9a7741deSElliott Hughesac ~ /ab{0,}c/ -> should be 1, is 1 91*9a7741deSElliott Hughesabc ~ /ab{0,}c/ -> should be 1, is 1 92*9a7741deSElliott Hughesac ~ /a(b{0,})c/ -> should be 1, is 1 93*9a7741deSElliott Hughesabc ~ /a(b{0,})c/ -> should be 1, is 1 94*9a7741deSElliott Hughesac ~ /ab{0,}*c/ -> should be 1, is 1 95*9a7741deSElliott Hughesabc ~ /ab{0,}*c/ -> should be 1, is 1 96*9a7741deSElliott Hughesac ~ /a(b{0,})*c/ -> should be 1, is 1 97*9a7741deSElliott Hughesabc ~ /a(b{0,})*c/ -> should be 1, is 1 98*9a7741deSElliott Hughesac ~ /ab{1}c/ -> should be 0, is 0 99*9a7741deSElliott Hughesabc ~ /ab{1}c/ -> should be 1, is 1 100*9a7741deSElliott Hughesabbc ~ /ab{1}c/ -> should be 0, is 0 101*9a7741deSElliott Hughesac ~ /ab{1,}c/ -> should be 0, is 0 102*9a7741deSElliott Hughesabc ~ /ab{1,}c/ -> should be 1, is 1 103*9a7741deSElliott Hughesabbc ~ /ab{1,}c/ -> should be 1, is 1 104*9a7741deSElliott Hughesabbbc ~ /ab{1,}c/ -> should be 1, is 1 105*9a7741deSElliott Hughesabbbbc ~ /ab{1,}c/ -> should be 1, is 1 106*9a7741deSElliott Hughesac ~ /ab{0,1}c/ -> should be 1, is 1 107*9a7741deSElliott Hughesabc ~ /ab{0,1}c/ -> should be 1, is 1 108*9a7741deSElliott Hughesabbc ~ /ab{0,1}c/ -> should be 0, is 0 109*9a7741deSElliott Hughesac ~ /ab{0,3}c/ -> should be 1, is 1 110*9a7741deSElliott Hughesabc ~ /ab{0,3}c/ -> should be 1, is 1 111*9a7741deSElliott Hughesabbc ~ /ab{0,3}c/ -> should be 1, is 1 112*9a7741deSElliott Hughesabbbc ~ /ab{0,3}c/ -> should be 1, is 1 113*9a7741deSElliott Hughesabbbbc ~ /ab{0,3}c/ -> should be 0, is 0 114*9a7741deSElliott Hughesac ~ /ab{1,3}c/ -> should be 0, is 0 115*9a7741deSElliott Hughesabc ~ /ab{1,3}c/ -> should be 1, is 1 116*9a7741deSElliott Hughesabbc ~ /ab{1,3}c/ -> should be 1, is 1 117*9a7741deSElliott Hughesabbbc ~ /ab{1,3}c/ -> should be 1, is 1 118*9a7741deSElliott Hughesabbbbc ~ /ab{1,3}c/ -> should be 0, is 0 119*9a7741deSElliott HughesEOF 120*9a7741deSElliott Hughes 121*9a7741deSElliott Hughes 122*9a7741deSElliott Hughes$awk -f prog foo.in > foo2 123*9a7741deSElliott Hughesdiff foo1 foo2 || echo 'BAD: T.int-expr (1)' 124*9a7741deSElliott Hughesrm -f prog 125