boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

001-bv-find.scm (558B)


      1 ;; tests/cc-util/01-bv-find.scm — bv-find returns first index >= from.
      2 ;; Assumes cc/util.scm is loaded.
      3 
      4 (if (= (bv-find "hello world" 32 0) 5) 0 (sys-exit 1))   ; first space
      5 (if (= (bv-find "aaaaa" 97 2) 2) 0 (sys-exit 2))         ; from honored
      6 (if (bv-find "abc" 122 0) (sys-exit 3) 0)                ; not found -> #f
      7 (if (bv-find "" 65 0) (sys-exit 4) 0)                    ; empty -> #f
      8 (if (bv-find "abc" 97 5) (sys-exit 5) 0)                 ; from past end -> #f
      9 (if (= (bv-find "abc" 99 0) 2) 0 (sys-exit 6))           ; last byte
     10 (sys-exit 0)