main
Matthew Butterick 10 years ago
parent a9edaea926
commit 1d91bd3b1b

@ -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)
(check-equal? (length (send queens-problem get-solutions)) 92)
(module+ main
(displayln "Tests passed"))

@ -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 "<Variable ~a>" _name))
(define (repr) (format "<variable% ~a>" _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"]))
(define Unassigned (new variable% [name "Unassigned"]))
Loading…
Cancel
Save