[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/parser-generator 80cf73d 019/434: Passing tests for val
From: |
ELPA Syncer |
Subject: |
[elpa] externals/parser-generator 80cf73d 019/434: Passing tests for valid-grammar syntax |
Date: |
Mon, 29 Nov 2021 15:58:59 -0500 (EST) |
branch: externals/parser-generator
commit 80cf73d3b6ea32e78eaf426cfad7de9d39efae5d
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Passing tests for valid-grammar syntax
---
parser.el | 1 +
test/parser-test.el | 99 ++++++++++++++++++++++++++++++++++-------------------
2 files changed, 65 insertions(+), 35 deletions(-)
diff --git a/parser.el b/parser.el
index 987ead7..074b0c4 100644
--- a/parser.el
+++ b/parser.el
@@ -234,6 +234,7 @@
(listp (car (cdr production)))
(symbolp (car (cdr production)))
(stringp (car (cdr production))))))
+ (message "RHS is invalid")
(setq is-valid nil))
;; Validate right-hand-side (RHS) of production
diff --git a/test/parser-test.el b/test/parser-test.el
index ed7f1dd..7544cc8 100644
--- a/test/parser-test.el
+++ b/test/parser-test.el
@@ -201,25 +201,41 @@
"Test function `parser--valid-grammar-p'."
(message "Starting tests for (parser--valid-grammar-p)")
- (should
- (equal
+ (should (equal
+ t
+ (parser--valid-grammar-p '((A B C) ("a" "b" "c") ((A "a")) A))))
+
+ (should (equal
nil
- (parser--valid-grammar-p 'B)))
+ (parser--valid-grammar-p '((A B C) ("a" "b" "c") ((A "a")) (A)))))
- (should
- (equal
+ (should (equal
+ nil
+ (parser--valid-grammar-p '((A B C) (("a" "b") "c") ((A "a")) A))))
+
+ (should (equal
+ nil
+ (parser--valid-grammar-p '(((A B) C) ("a" "b" "c") ((A "a")) A))))
+
+ (should (equal
+ nil
+ (parser--valid-grammar-p '(((A B) C) ("a" "b" "c") ((A)) A))))
+
+ (should (equal
nil
(parser--valid-grammar-p "A")))
- (should
- (equal
+ (should (equal
nil
(parser--valid-grammar-p '(A B C))))
- (should
- (equal
- t
- (parser--valid-grammar-p '((A B C) (a b c) ((A ab a)(B b)(C c)) A))))
+ (should (equal
+ nil
+ (parser--valid-grammar-p '((A B)))))
+
+ (should (equal
+ nil
+ (parser--valid-grammar-p '((A B C) (a (b c) "c") (A ("a" "b") (a b)) (B b)
(C "c")))))
(message "Passed tests for (parser--valid-grammar-p)"))
@@ -227,35 +243,29 @@
"Test function `parser--valid-look-ahead-number-p'."
(message "Starting tests for (parser--valid-look-ahead-number-p)")
- (should
- (equal
- nil
- (parser--valid-look-ahead-number-p 'A)))
+ (should (equal
+ nil
+ (parser--valid-look-ahead-number-p 'A)))
- (should
- (equal
- nil
- (parser--valid-look-ahead-number-p "A")))
+ (should (equal
+ nil
+ (parser--valid-look-ahead-number-p "A")))
- (should
- (equal
- nil
- (parser--valid-look-ahead-number-p -2)))
+ (should (equal
+ nil
+ (parser--valid-look-ahead-number-p -2)))
- (should
- (equal
- nil
- (parser--valid-look-ahead-number-p 3.3)))
+ (should (equal
+ nil
+ (parser--valid-look-ahead-number-p 3.3)))
- (should
- (equal
- t
- (parser--valid-look-ahead-number-p 2)))
+ (should (equal
+ t
+ (parser--valid-look-ahead-number-p 2)))
- (should
- (equal
- t
- (parser--valid-look-ahead-number-p 1)))
+ (should (equal
+ t
+ (parser--valid-look-ahead-number-p 1)))
(message "Passed tests for (parser--valid-look-ahead-number-p)"))
@@ -265,9 +275,28 @@
(message "Passed tests for (parser--valid-sentential-form-p)"))
+(defun parser-test--valid-production-p ()
+ "Test `parser--valid-production-p'."
+ (message "Starting tests for (parser--valid-production-p)")
+
+ (should (equal
+ t
+ (parser--valid-production-p '(A a))))
+
+ (should (equal
+ nil
+ (parser--valid-production-p "A")))
+
+ (should (equal
+ nil
+ (parser--valid-production-p '((A a)))))
+
+ (message "Passed tests for (parser--valid-production-p)"))
+
(defun parser-test ()
"Run test."
(parser-test--valid-look-ahead-number-p)
+ (parser-test--valid-production-p)
(parser-test--valid-grammar-p)
(parser-test--distinct)
(parser-test--valid-sentential-form-p)
- [elpa] externals/parser-generator 356720c 030/434: Passing all unit tests using new data structure, (continued)
- [elpa] externals/parser-generator 356720c 030/434: Passing all unit tests using new data structure, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator e4fd795 007/434: Added compilation to test, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 42d92f1 014/434: More refactoring, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator f648b52 020/434: Passing first unit test for FIRST after new data-structure refactor, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator a4bbb2f 026/434: Using PDA algorithm for FIRST when β is above 1 symbol, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator e02d5d7 049/434: More work on calculating valid LR-items, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 0465b58 045/434: Improved commenting, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 85dde51 009/434: Added License and Travis build logos, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 7bc3b70 017/434: Updated tests to use new data structure, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator ab4b4db 021/434: Passed second FIRST test again, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 80cf73d 019/434: Passing tests for valid-grammar syntax,
ELPA Syncer <=
- [elpa] externals/parser-generator bbbdea3 034/434: More improvement of documentation, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 9d0d9e5 027/434: Various debugging, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator e644708 018/434: Improved validation of grammar syntax, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator fbb8cad 012/434: Starting a refactor, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 563cbdd 023/434: Passed FIRST tests for semi-complex grammar, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator dc78de7 025/434: Fixed page comment reference, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 3e02435 028/434: Passing complex 2 test, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 8e99d0c 035/434: Fixed typo, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator bc1ec12 036/434: Improved documentation, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator fe94691 048/434: Added hash-table for production RHS, ELPA Syncer, 2021/11/29