[plt-scheme] An order insensitive check-expect

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Feb 19 11:53:44 EST 2010

You can sort both lists before using check-expect.

Or you can use schemeunit and define your own check:

#lang scheme
(require schemeunit)

(define-simple-check (check-same-elements l1 l2)
  (and (list? l1)
       (list? l2)
       (andmap (λ (l1-ele) (member l1-ele l2)) l1)
       (andmap (λ (l2-ele) (member l2-ele l1)) l2)))

(check-same-elements (list 1 2 3)
                     (list 2 3 1))
(check-same-elements (list 1 2 4)
                     (list 1 2 3))

On Fri, Feb 19, 2010 at 10:50 AM, wooks <wookiz at hotmail.com> wrote:
> If your expected result is a list where order is irrelevant is it
> possible to have check-expect not fail solely on account of the
> ordering of the result.?
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.