From b256fc334a6c8868a6159f32adb6dba01fefca86 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sun, 24 Feb 2019 20:33:55 +0100 Subject: Add CLOS to union-find --- test/union-find/test-quick-find.lisp | 45 ------------------------------------ 1 file changed, 45 deletions(-) delete mode 100644 test/union-find/test-quick-find.lisp (limited to 'test/union-find/test-quick-find.lisp') diff --git a/test/union-find/test-quick-find.lisp b/test/union-find/test-quick-find.lisp deleted file mode 100644 index f173ea6..0000000 --- a/test/union-find/test-quick-find.lisp +++ /dev/null @@ -1,45 +0,0 @@ -(load "../lisp-unit.lisp") -(defpackage :test-quick-find - (:use :common-lisp - :lisp-unit)) - -(in-package :test-quick-find) -(load "../../src/union-find/quick-find.lisp") - -;;; Define tests -(define-test test-create-network - (assert-equal 10 (length (create-network 10))) - (assert-equalp #(0 1 2 3 4) (create-network 5))) - -(define-test test-union_ - (let ((nw (create-network 10))) - (setf nw (union_ nw 1 2)) - (setf nw (union_ nw 0 5)) - (assert-equal (aref nw 1) (aref nw 2)) - (assert-equal (aref nw 0) (aref nw 5)) - (assert-false (equal (aref nw 0) (aref nw 8))) - (assert-false (equal (aref nw 0) (aref nw 2))))) - -(define-test test-connected - (let ((nw (create-network 10))) - (setf nw (union_ nw 1 2)) - (setf nw (union_ nw 0 5)) - (assert-true (connected nw 1 2)) - (assert-true (connected nw 0 5)) - (assert-false (connected nw 0 8)) - (assert-false (connected nw 0 2)))) - -(define-test test-nunion__ - (let ((nw (create-network 10))) - (nunion_ nw 1 2) - (nunion_ nw 0 5) - (assert-equal (aref nw 1) (aref nw 2)) - (assert-equal (aref nw 0) (aref nw 5)) - (assert-false (equal (aref nw 0) (aref nw 8))) - (assert-false (equal (aref nw 0) (aref nw 2))))) - -;; Run all tests -(setq *print-summary* t) ; Details tests locations when running tests -(run-tests :all) - - -- cgit v1.2.3