Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Drop fare-matcher dependency

It was used in arithmetic/expression test to generate more readable expression tree, but that
matters only when inspecting the parse tree for errors, not for the test themselves.
  • Loading branch information...
commit 66e455502a8c386471eb3e06cb9b795917cf2bb6 1 parent 65dd231
@Ramarren authored
View
2  parser-combinators-tests.asd
@@ -4,7 +4,7 @@
:maintainer "Jakub Higersberger <ramarren@gmail.com>"
:author "Jakub Higersberger <ramarren@gmail.com>"
:licence "BSD-style"
- :depends-on (:hu.dwim.stefil :iterate :alexandria :parser-combinators :infix :fare-matcher)
+ :depends-on (:hu.dwim.stefil :iterate :alexandria :parser-combinators :infix)
:components ((:file "test-root")
(:file "test-basic" :depends-on ("test-root"))
(:file "test-parsers" :depends-on ("test-root"))
View
23 test-arithmetic.lisp
@@ -37,37 +37,16 @@
(collect (digit-char (1+ (random 9))))))
'string))
-(defun collapse-ops (op-tree)
- (labels ((collapse-top (op-tree)
- (match op-tree
- ((like-when (list* op1 (cons op2 inner) outer) (eql op1 op2))
- (collapse-ops (list* op1 (mapcar #'collapse-ops (append inner outer)))))
- (thing
- thing))))
- (match op-tree
- ((like-when (list* op1 (cons op2 inner) outer) (eql op1 op2))
- (collapse-top (list* op1 (mapcar #'collapse-ops (append inner outer)))))
- ((cons op args)
- (collapse-top (list* op (mapcar #'collapse-ops args))))
- (thing
- thing))))
-
(deftest test-random-arith ()
(iter (repeat 100)
(let ((arith-string (make-random-arith-string 100)))
(is (handler-case
(= (eval (infix:string->prefix arith-string))
- (eval (collapse-ops (tree-of (current-result (parse-string (arith*) arith-string))))))
+ (eval (tree-of (current-result (parse-string (arith*) arith-string)))))
(division-by-zero ()
(print 'division-by-zero)
t))))))
-(deftest test-print-random-arith (size)
- (let ((arith-string (make-random-arith-string size)))
- (print arith-string)
- (is (equal (print (infix:string->prefix arith-string))
- (print (collapse-ops (tree-of (current-result (parse-string (arith*) arith-string)))))))))
-
(defun measure-time (min-size max-size step &optional (parser (arith*)))
(iter (for i from min-size to max-size by step)
(print i)
View
2  test-expression.lisp
@@ -55,7 +55,7 @@
(let ((arith-string (make-random-arith-string 100)))
(is (handler-case
(= (eval (infix:string->prefix arith-string))
- (eval (collapse-ops (tree-of (current-result (parse-string (expr-arith*) arith-string))))))
+ (eval (tree-of (current-result (parse-string (expr-arith*) arith-string)))))
(division-by-zero ()
(print 'division-by-zero)
t))))))
View
3  test-root.lisp
@@ -1,5 +1,4 @@
-(defpackage :parser-combinators-tests (:use :cl :hu.dwim.stefil :iterate :parser-combinators :alexandria)
- (:import-from :fare-matcher #:match #:like-when))
+(defpackage :parser-combinators-tests (:use :cl :hu.dwim.stefil :iterate :parser-combinators :alexandria))
(in-package :parser-combinators-tests)
Please sign in to comment.
Something went wrong with that request. Please try again.