(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"basic tests for the SHA1 array implementation">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: echo20 body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:prefix) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 1> suffix_op: (StringUnary op_id: VTest_ColonPlus arg_word: {($ VSub_Number "$1") (" ")} ) spids: [24 29] ) ) } spids: [22] ) ] spids: [22] ) (C {(shift)}) (While cond: [(C {(test)} {($ VSub_Pound "$#")} {(-gt)} {(0)})] body: (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: [47 80] ) ) ] spids: [19] ) spids: [14 18] ) (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)}) ] )