unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* SRFI-64 module and SRFI-78 module -- archive file attached
@ 2012-04-26  8:27 Sunjoong Lee
  2012-05-03  6:45 ` Sunjoong Lee
  0 siblings, 1 reply; 3+ messages in thread
From: Sunjoong Lee @ 2012-04-26  8:27 UTC (permalink / raw)
  To: guile-user


[-- Attachment #1.1: Type: text/plain, Size: 1510 bytes --]

Hello,

I've attatched a file archiving modules of my recent version of SRFI-64
implementation and SRFI-78.

SRFI-64 is "A Scheme API for test suites."
SRFI-78 is "Lightweight testing."

If you want to test your code, there are 5 options; using SRFI-64, SRFI-78,
unit-test of guile-lib, lib of test-suite in Guile source archive or your
own test suite. Here is four examples:

;;; filename: srfi-64-example.scm
(use-modules (srfi srfi-64))
(test-begin "vec-test")
(define v (make-vector 5 99))
(test-assert (vector? v))
(test-eqv 99 (vector-ref v 2))
(vector-set! v 2 7)
(test-eqv 7 (vector-ref v 2))
(test-end "vec-test")

;;; filename: srfi-78-example.scm
(use-modules (srfi srfi-78))
(define v (make-vector 5 99))
(check (vector? v) => #t)
(check (vector-ref v 2) => 99)
(vector-set! v 2 7)
(check (vector-ref v 2) => 7)

;;; filename: unit-test-example.scm
(use-modules (unit-test) (oop goops))
(define v (make-vector 5 99))
(define-class <vec-test> (<test-case>))
(define-method (test-vector? (self <vec-test>))
  (assert-true (vector? v)))
(define-method (test-99 (self <vec-test>))
  (assert-equal 99 (vector-ref v 2)))
(define-method (test-7 (self <vec-test>))
  (vector-set! v 2 7)
  (assert-equal 7 (vector-ref v 2)))
(exit-with-summary (run-all-defined-test-cases))

;;; filename: test-suite-example.scm
(use-modules (test-suite lib))
(define v (make-vector 5 99))
(pass-if "vector?" (vector? v))
(pass-if "99" (eqv? 99 (vector-ref v 2)))
(vector-set! v 2 7)
(pass-if "7" (eqv? 7 (vector-ref v 2)))

[-- Attachment #1.2: Type: text/html, Size: 2230 bytes --]

[-- Attachment #2: srfi-64_and_srfi-78.tar.gz --]
[-- Type: application/x-gzip, Size: 11829 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-14 14:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-26  8:27 SRFI-64 module and SRFI-78 module -- archive file attached Sunjoong Lee
2012-05-03  6:45 ` Sunjoong Lee
2012-05-14 14:07   ` Sunjoong Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).