private/test-hash-cons.ss
(module test-hash-cons mzscheme
  (require "hash-cons.ss"
           "../make-hash-struct.ss"
           (lib "etc.ss")
           (planet "test.ss" ("schematics" "schemeunit.plt" 2 8)))
  
  (provide hash-cons-tests)
  (define hash-cons-tests
    (test-suite
     "hash-cons.ss and make-hash-struct.ss tests"
     (test-case
      "simple test"
      (let ([p1 (hash-cons 1 2)]
            [p2 (hash-cons 1 2)])
        (check-eq? p1 p2)
        (check-equal? p1 (cons 1 2))))
     
     (test-case
      "simple test 2"
      (let ([p1 (hash-cons 3 4)]
            [p2 (hash-cons 4 (hash-cons 3 4))])
        (check-eq? p1 (cdr p2))
        (check-false (eq? p1 p2))))
     
     (test-case
      "make-hash-struct"
      (local
          ((define-struct tree (key left right) #f)
           (define htree
             (make-hash-struct
              make-tree
              3
              (0 #f #f)
              (set-tree-key! set-tree-left! set-tree-right!))))
        (let ([my-tree (htree 3 (htree 1 #f #f) (htree 1 #f #f))])
          (check-eq? (tree-left my-tree) (tree-right my-tree))))))))