Last active
March 10, 2020 11:51
-
-
Save JekoTronik/a4aecd11449b97e36728840076124c56 to your computer and use it in GitHub Desktop.
Test refactoring in Guile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-module (harness-guile) | |
#:use-module (srfi srfi-64)) | |
(module-define! (resolve-module '(srfi srfi-64)) | |
'test-log-to-file #t) | |
(define EMPTY_STRING "") | |
(define (rotations str) | |
`(,str)) | |
(test-begin "test-suite") | |
(define test-case-descriptions | |
'(["empty-string" (EMPTY_STRING) EMPTY_STRING] | |
["one-char-string" ("a") "a"])) | |
(define (test-equal-batch triples) | |
(map (lambda (triple) | |
(let ([test-name (car triple)] | |
[expected-value (car (cdr triple))] | |
[actual-value (car (cddr triple))]) | |
(test-equal test-name | |
expected-value | |
(rotations actual-value)))) | |
triples)) | |
(test-equal-batch test-case-descriptions) | |
(test-end "test-suite") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%% Starting test test-suite | |
Group begin: test-suite | |
Test begin: | |
test-name: "empty-string" | |
source-file: "/home/jeko/Workspace/Kata/kata_3/kata_3.scm" | |
source-line: 33 | |
source-form: (test-equal test-name expected-value (rotations actual-value)) | |
Test end: | |
result-kind: pass | |
actual-value: (EMPTY_STRING) | |
expected-value: (EMPTY_STRING) | |
Test begin: | |
test-name: "one-char-string" | |
source-file: "/home/jeko/Workspace/Kata/kata_3/kata_3.scm" | |
source-line: 33 | |
source-form: (test-equal test-name expected-value (rotations actual-value)) | |
Test end: | |
result-kind: pass | |
actual-value: ("a") | |
expected-value: ("a") | |
Group end: test-suite | |
# of expected passes 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment