From f3444c7e51dfe74908c1b3fb3d81bfb963ae869a Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Sun, 11 Aug 2013 15:14:09 -0400 Subject: [PATCH] tests for Xexpr readers --- .../tests/batch-io-xexpr-enumeration.xml | 10 ++++++ .../2htdp/tests/batch-io-xexpr-machine.xml | 5 +++ .../htdp-lib/2htdp/tests/batch-io-xexpr.rkt | 31 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr-enumeration.xml create mode 100644 pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr-machine.xml create mode 100644 pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr.rkt diff --git a/pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr-enumeration.xml b/pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr-enumeration.xml new file mode 100644 index 0000000000..2d10c2327f --- /dev/null +++ b/pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr-enumeration.xml @@ -0,0 +1,10 @@ + diff --git a/pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr-machine.xml b/pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr-machine.xml new file mode 100644 index 0000000000..6ac1881ada --- /dev/null +++ b/pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr-machine.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr.rkt b/pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr.rkt new file mode 100644 index 0000000000..769179dfb9 --- /dev/null +++ b/pkgs/htdp-pkgs/htdp-lib/2htdp/tests/batch-io-xexpr.rkt @@ -0,0 +1,31 @@ +#lang racket + +(require 2htdp/batch-io rackunit) + +(define url "http://www.ccs.neu.edu/home/matthias/HtDP2e/Files/") + +(define local-machine-configuration "batch-io-xexpr-machine.xml") +(define remote-machine-configuration (string-append url "machine-configuration.xml")) + +(check-true (url-exists? remote-machine-configuration)) + +(define xm0 (read-plain-xexpr local-machine-configuration)) +(define xm1 (read-xexpr local-machine-configuration)) +(define rxm0 (read-plain-xexpr/web remote-machine-configuration)) +(define rxm1 (read-xexpr/web remote-machine-configuration)) + +(check-equal? xm0 rxm0 "compare remote and local machine config, plain XML") +(check-equal? xm1 rxm1 "compare remote and local machine config, XML with white space") + +(define local-enumeration "batch-io-xexpr-enumeration.xml") +(define remote-enumeration (string-append url "enumeration.xml")) + +(check-true (url-exists? remote-enumeration)) + +(define en0 (read-plain-xexpr local-enumeration)) +(define en1 (read-xexpr local-enumeration)) +(define ren0 (read-plain-xexpr/web remote-enumeration)) +(define ren1 (read-xexpr/web remote-enumeration)) + +(check-equal? xm0 rxm0 "compare remote and local enumeration, plain XML") +(check-equal? xm1 rxm1 "compare remote and local enumeration, XML with white space") \ No newline at end of file