(CommandList
  children: [
    (FuncDef
      name: is_number
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_Local
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:NUMBER)
                      op: Equal
                      rhs: {($ VSub_Number "$1")}
                      spids: [13]
                    )
                  ]
                  spids: [11]
                )
              terminator: <Op_Semi ";">
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:NUM_RE)
                  op: Equal
                  rhs: {(SQ <"^[1-4]+$">)}
                  spids: [19]
                )
              ]
              spids: [17]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_EqualTilde
                              left: {($ VSub_Name "$NUMBER")}
                              right: {($ VSub_Name "$NUM_RE")}
                            )
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})]
                  spids: [-1 38]
                )
              ]
              else_action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})]
              spids: [46 54]
            )
          ]
          spids: [8]
        )
      spids: [4 7]
    )
    (FuncDef
      name: usage
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {(DQ ("usage: ") ($ VSub_Number "$0") (" 1|2|3|4"))})
            (C {(exit)} {(0)})
          ]
          spids: [63]
        )
      spids: [59 62]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:BATCH_NUM)
          op: Equal
          rhs: {(DQ ($ VSub_Number "$1"))}
          spids: [82]
        )
      ]
      spids: [82]
    )
    (AndOr
      children: [(C {(is_number)} {(DQ ($ VSub_Name "$BATCH_NUM"))}) (C {(usage)})]
      op_id: Op_DPipe
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:TESTS)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (Pipeline
                        children: [
                          (C {(find)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(dirname)} {(DQ ($ VSub_Number "$0"))})]
                                    )
                                  left_token: <Left_CommandSub "$(">
                                  spids: [103 109]
                                ) (/../unit)
                              )
                            } {(-maxdepth)} {(1)} {(-name)} {(DQ (${ VSub_Name BATCH_NUM) ("0*.bats"))}
                          )
                          (C {(sort)} {(-n)})
                          (C {(xargs)})
                        ]
                        negated: False
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [99 135]
              )
            }
          spids: [98]
        )
      ]
      spids: [98]
    )
    (C {(echo)} {(DQ ("running the following tests ") ($ VSub_Name "$TESTS"))})
    (ForEach
      iter_name: test
      iter_words: [{($ VSub_Name "$TESTS")}]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (C {(echo)} {($ VSub_Name "$test")})
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:starttest)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {(date)} {(Lit_Other "+") (Lit_Other "%") (s)})]
                          )
                        left_token: <Left_CommandSub "$(">
                        spids: [166 172]
                      )
                    }
                  spids: [165]
                )
              ]
              spids: [165]
            )
            (C {(bats)} {($ VSub_Name "$test")})
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:RC)
                  op: Equal
                  rhs: {($ VSub_QMark "$?")}
                  spids: [181]
                )
              ]
              spids: [181]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolBinary op_id:BoolBinary_ne left:{($ VSub_Name "$RC")} right:{(0)})
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(echo)} {(DQ ("exit status: ") ($ VSub_Name "$RC"))})
                    (C {(exit)} {($ VSub_Name "$RC")})
                  ]
                  spids: [-1 198]
                )
              ]
              spids: [-1 214]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:endtest)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {(date)} {(Lit_Other "+") (Lit_Other "%") (s)})]
                          )
                        left_token: <Left_CommandSub "$(">
                        spids: [219 225]
                      )
                    }
                  spids: [218]
                )
              ]
              spids: [218]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:testruntime)
                  op: Equal
                  rhs: 
                    {
                      (ArithSubPart
                        anode: 
                          (ArithBinary
                            op_id: Arith_Minus
                            left: (ArithVarRef name:endtest)
                            right: (ArithVarRef name:starttest)
                          )
                        spids: [229 234]
                      )
                    }
                  spids: [228]
                )
              ]
              spids: [228]
            )
            (C {(echo)} 
              {
                (DQ ("individual runtime: ") 
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [
                          (C {(date)} {(-u)} {(-d)} {(Lit_Other "@") (${ VSub_Name testruntime)} 
                            {(Lit_Other "+") (DQ ("%T"))}
                          )
                        ]
                      )
                    left_token: <Left_CommandSub "$(">
                    spids: [241 257]
                  )
                )
              }
            )
          ]
          spids: [157 260]
        )
      spids: [153 155]
    )
  ]
)