Sha256: 91649fa7c9fe41e5a78dd0f0397e434f896e25f61f8f7ec8b25f4ec4dd2fe9e4
Contents?: true
Size: 1010 Bytes
Versions: 396
Compression:
Stored size: 1010 Bytes
Contents
#lang racket (require "accumulate.rkt") (module+ test (require rackunit rackunit/text-ui) (define reverse-words (lambda (word) (list->string (reverse (string->list word))))) (define suite (test-suite "accumulate tests" (test-equal? "empty list" (accumulate empty (lambda (arg) arg)) empty) (test-equal? "squaring" (accumulate '(1 3 4) (lambda (arg) (* arg arg))) '(1 9 16)) (test-equal? "upper cases" (let ([toupper (lambda (word) (string-upcase word))]) (accumulate '("hello" "world") toupper)) '("HELLO" "WORLD")) (test-equal? "reverse strings" (accumulate (list "the" "quick" "brown" "fox" "jumped" "over" "the" "lazy" "dog") reverse-words) (map reverse-words '("the" "quick" "brown" "fox" "jumped" "over" "the" "lazy" "dog"))))) (run-tests suite))
Version data entries
396 entries across 396 versions & 1 rubygems