(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description spids:[12]) op: Equal rhs: {(SQ <'basic tests for the SHA1 array implementation'>)} spids: [12] ) ] spids: [12] ) (C {(.)} {(./test-lib.sh)}) (command.FuncDef name: echo20 body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:prefix spids:[30]) op: Equal rhs: { (DQ (word_part.BracedVarSub token: <VSub_Number 1> suffix_op: (suffix_op.StringUnary op_id: VTest_ColonPlus arg_word: {($ VSub_Number '$1') (' ')} ) spids: [32 37] ) ) } spids: [30] ) ] spids: [30] ) (C {(shift)}) (command.WhileUntil keyword: <KW_While while> cond: [(C {(test)} {($ VSub_Pound '$#')} {(-gt)} {(0)})] body: (command.DoGroup children: [ (C {(echo)} { (DQ ($ VSub_Name '$prefix') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ($ VSub_Number '$1') ) } ) (C {(shift)}) ] spids: [55 88] ) ) ] spids: [27] ) spids: [22 26] ) (C {(test_expect_success)} {(SQ <'ordered enumeration'>)} { (SQ <'\n'> <'\techo20 "" 44 55 88 aa >expect &&\n'> <'\t{\n'> <'\t\techo20 append 88 44 aa 55 &&\n'> <'\t\techo for_each_unique\n'> <'\t} | test-sha1-array >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'ordered enumeration with duplicate suppression'>)} { (SQ <'\n'> <'\techo20 "" 44 55 88 aa >expect &&\n'> <'\t{\n'> <'\t\techo20 append 88 44 aa 55 &&\n'> <'\t\techo20 append 88 44 aa 55 &&\n'> <'\t\techo for_each_unique\n'> <'\t} | test-sha1-array >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <lookup>)} { (SQ <'\n'> <'\t{\n'> <'\t\techo20 append 88 44 aa 55 &&\n'> <'\t\techo20 lookup 55\n'> <'\t} | test-sha1-array >actual &&\n'> <'\tn=$(cat actual) &&\n'> <'\ttest "$n" -eq 1\n'> ) } ) (C {(test_expect_success)} {(SQ <'lookup non-existing entry'>)} { (SQ <'\n'> <'\t{\n'> <'\t\techo20 append 88 44 aa 55 &&\n'> <'\t\techo20 lookup 33\n'> <'\t} | test-sha1-array >actual &&\n'> <'\tn=$(cat actual) &&\n'> <'\ttest "$n" -lt 0\n'> ) } ) (C {(test_expect_success)} {(SQ <'lookup with duplicates'>)} { (SQ <'\n'> <'\t{\n'> <'\t\techo20 append 88 44 aa 55 &&\n'> <'\t\techo20 append 88 44 aa 55 &&\n'> <'\t\techo20 lookup 55\n'> <'\t} | test-sha1-array >actual &&\n'> <'\tn=$(cat actual) &&\n'> <'\ttest "$n" -ge 2 &&\n'> <'\ttest "$n" -le 3\n'> ) } ) (C {(test_expect_success)} {(SQ <'lookup non-existing entry with duplicates'>)} { (SQ <'\n'> <'\t{\n'> <'\t\techo20 append 88 44 aa 55 &&\n'> <'\t\techo20 append 88 44 aa 55 &&\n'> <'\t\techo20 lookup 66\n'> <'\t} | test-sha1-array >actual &&\n'> <'\tn=$(cat actual) &&\n'> <'\ttest "$n" -lt 0\n'> ) } ) (C {(test_expect_success)} {(SQ <'lookup with almost duplicate values'>)} { (SQ <'\n'> <'\t{\n'> <'\t\techo "append 5555555555555555555555555555555555555555" &&\n'> <'\t\techo "append 555555555555555555555555555555555555555f" &&\n'> <'\t\techo20 lookup 55\n'> <'\t} | test-sha1-array >actual &&\n'> <'\tn=$(cat actual) &&\n'> <'\ttest "$n" -eq 0\n'> ) } ) (C {(test_expect_success)} {(SQ <'lookup with single duplicate value'>)} { (SQ <'\n'> <'\t{\n'> <'\t\techo20 append 55 55 &&\n'> <'\t\techo20 lookup 55\n'> <'\t} | test-sha1-array >actual &&\n'> <'\tn=$(cat actual) &&\n'> <'\ttest "$n" -ge 0 &&\n'> <'\ttest "$n" -le 1\n'> ) } ) (C {(test_done)}) ] )