From 1d91bd3b1b7aad2fab57a6dd0df1c0d968bbb725 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sat, 4 Oct 2014 18:41:04 -0700 Subject: [PATCH] tweaks --- csp/test-problems.rkt | 7 +++++-- csp/variable.rkt | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/csp/test-problems.rkt b/csp/test-problems.rkt index 59f99b46..203e0cdb 100644 --- a/csp/test-problems.rkt +++ b/csp/test-problems.rkt @@ -1,5 +1,5 @@ #lang racket -(require "main.rkt") +(require "main.rkt" "test-classes.rkt") (require rackunit) @@ -142,4 +142,7 @@ A collection of 33 coins, consisting of nickels, dimes, and quarters, has a valu (not (= (abs (- row1 row2)) (abs (- col1 col2)))) ;; test if two cells are in same row (not (= row1 row2)))) (list col1 col2))) -(check-equal? (length (send queens-problem get-solutions)) 92) \ No newline at end of file +(check-equal? (length (send queens-problem get-solutions)) 92) + +(module+ main + (displayln "Tests passed")) \ No newline at end of file diff --git a/csp/variable.rkt b/csp/variable.rkt index 3c7213f1..727a469e 100644 --- a/csp/variable.rkt +++ b/csp/variable.rkt @@ -2,16 +2,16 @@ (require racket/class "helper.rkt") (provide (all-defined-out)) -(define Variable +(define variable% (class* object% (printable<%>) (super-new) - (define (repr) (format "" _name)) + (define (repr) (format "" _name)) (define/public (custom-print out quoting-depth) (print (repr) out)) (define/public (custom-display out) (displayln (repr) out)) (define/public (custom-write out) (write (repr) out)) (init-field name) (field [_name name]))) -(define Variable? (is-a?/c Variable)) +(define variable%? (is-a?/c variable%)) -(define Unassigned (new Variable [name "Unassigned"])) \ No newline at end of file +(define Unassigned (new variable% [name "Unassigned"])) \ No newline at end of file