[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 34c1d75 05/19: * Enumerate and split type specifier
From: |
Andrea Corallo |
Subject: |
feature/native-comp 34c1d75 05/19: * Enumerate and split type specifier tests in comp-tests.el to ease debug |
Date: |
Mon, 21 Dec 2020 14:52:38 -0500 (EST) |
branch: feature/native-comp
commit 34c1d75a317778df1c09f29f10af207d0f36ad13
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Enumerate and split type specifier tests in comp-tests.el to ease debug
* test/src/comp-tests.el (comp-tests-type-spec-tests): Enumerate.
(comp-tests-define-type-spec-test): New function.
(comp-tests-define-type-spec-tests): New macro to expand tests.
---
test/src/comp-tests.el | 64 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 47 insertions(+), 17 deletions(-)
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 68201de..4ea8dbb 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -790,18 +790,23 @@ Return a list of results."
(native-compile (cadr func-form))))
(defconst comp-tests-type-spec-tests
- `(((defun comp-tests-ret-type-spec-f (x)
+ `(
+ ;; 1
+ ((defun comp-tests-ret-type-spec-f (x)
x)
t)
+ ;; 2
((defun comp-tests-ret-type-spec-f ()
1)
(integer 1 1))
+ ;; 3
((defun comp-tests-ret-type-spec-f (x)
(if x 1 3))
(or (integer 1 1) (integer 3 3)))
+ ;; 4
((defun comp-tests-ret-type-spec-f (x)
(let (y)
(if x
@@ -810,6 +815,7 @@ Return a list of results."
y))
(integer 1 2))
+ ;; 5
((defun comp-tests-ret-type-spec-f (x)
(let (y)
(if x
@@ -818,77 +824,90 @@ Return a list of results."
y))
(or (integer 1 1) (integer 3 3)))
+
+ ;; 6
((defun comp-tests-ret-type-spec-f (x)
(if x
(list x)
3))
(or cons (integer 3 3)))
+ ;; 7
((defun comp-tests-ret-type-spec-f (x)
(if x
'foo
3))
(or (member foo) (integer 3 3)))
+ ;; 8
((defun comp-tests-ret-type-spec-f (x)
(if (eq x 3)
x
'foo))
(or (member foo) (integer 3 3)))
+ ;; 9
((defun comp-tests-ret-type-spec-f (x)
(if (eq 3 x)
x
'foo))
(or (member foo) (integer 3 3)))
+ ;; 10
((defun comp-tests-ret-type-spec-f (x)
(if (= x 3)
x
'foo))
(or (member foo) (integer 3 3)))
+ ;; 11
((defun comp-tests-ret-type-spec-f (x)
(if (= 3 x)
x
'foo))
(or (member foo) (integer 3 3)))
- ;; FIXME would be nice to have (or number (member foo))
+ ;; 12
((defun comp-tests-ret-type-spec-8-3-f (x)
(if (= x 3)
'foo
x))
- t)
+ (or (member foo) (integer * 2) (integer 4 *)))
+ ;; 13
((defun comp-tests-ret-type-spec-8-4-f (x y)
(if (= x y)
x
'foo))
- (or (member foo) number))
+ t)
+ ;; 14
((defun comp-tests-ret-type-spec-9-1-f (x)
(comp-hint-fixnum x))
(integer ,most-negative-fixnum ,most-positive-fixnum))
+ ;; 15
((defun comp-tests-ret-type-spec-f (x)
(comp-hint-cons x))
cons)
+ ;; 16
((defun comp-tests-ret-type-spec-f (x)
- (let (y)
- (when x
- (setf y 4))
- y))
+ (let (y)
+ (when x
+ (setf y 4))
+ y))
(or null (integer 4 4)))
+ ;; 17
((defun comp-tests-ret-type-spec-f ()
- (let (x
- (y 3))
- (setf x y)
- y))
+ (let (x
+ (y 3))
+ (setf x y)
+ y))
(integer 3 3))
+ ;; 18
((defun comp-tests-ret-type-spec-f (x)
(let ((y 3))
(when x
@@ -896,15 +915,26 @@ Return a list of results."
y))
t)
+ ;; 19
((defun comp-tests-ret-type-spec-f (x y)
(eq x y))
boolean)))
-(comp-deftest ret-type-spec ()
- "Some derived return type specifier tests."
- (cl-loop with comp-ctxt = (make-comp-cstr-ctxt)
- for (func-form type-spec) in comp-tests-type-spec-tests
- do (comp-tests-check-ret-type-spec func-form type-spec)))
+(defun comp-tests-define-type-spec-test (number x)
+ `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) ()
+ ,(format "Type specifier test number %d." number)
+ (let ((comp-ctxt (make-comp-cstr-ctxt)))
+ (comp-tests-check-ret-type-spec ',(car x) ',(cadr x)))))
+
+(defmacro comp-tests-define-type-spec-tests ()
+ "Define all type specifier tests."
+ `(progn
+ ,@(cl-loop
+ for test in comp-tests-type-spec-tests
+ for n from 1
+ collect (comp-tests-define-type-spec-test n test))))
+
+(comp-tests-define-type-spec-tests)
(defun comp-tests-pure-checker-1 (_)
"Check that inside `comp-tests-pure-caller-f' `comp-tests-pure-callee-f' is
- feature/native-comp updated (5b10a03 -> 9676e4d), Andrea Corallo, 2020/12/21
- feature/native-comp 2a117ad 01/19: * Add mvar pretty print support when dumping LIMPLE, Andrea Corallo, 2020/12/21
- feature/native-comp bad18f5 02/19: * Improve comp-fwprop pass, Andrea Corallo, 2020/12/21
- feature/native-comp a0c0daf 03/19: * Fix a number of type specifier simplification tests, Andrea Corallo, 2020/12/21
- feature/native-comp 34c1d75 05/19: * Enumerate and split type specifier tests in comp-tests.el to ease debug,
Andrea Corallo <=
- feature/native-comp 7074988 06/19: * Add a type specifier test to comp-cstr-tests.el, Andrea Corallo, 2020/12/21
- feature/native-comp 0255108 08/19: * Rename comp-cond-cstr into comp-add-cstrs, Andrea Corallo, 2020/12/21
- feature/native-comp 48d43f5 04/19: * Improve constraint simplification logic in comp-cstr.el, Andrea Corallo, 2020/12/21
- feature/native-comp 07b75de 10/19: Enhance type inference constraining function arguments, Andrea Corallo, 2020/12/21
- feature/native-comp e0f20da 14/19: Simplify correctly (or (integer 1 1) (not (integer 1 1))) as t, Andrea Corallo, 2020/12/21
- feature/native-comp 6f3570c 16/19: Fix value type inference for doubly negate constraints, Andrea Corallo, 2020/12/21
- feature/native-comp d072ee9 07/19: * Two minors in comp.el, Andrea Corallo, 2020/12/21
- feature/native-comp 23791cf 09/19: * Allow for modifying insn-cell inside `comp-loop-insn-in-block', Andrea Corallo, 2020/12/21
- feature/native-comp 9bbe6ea 15/19: Fix native compiler tests when they are bytecompiled, Andrea Corallo, 2020/12/21
- feature/native-comp 8e816b0 11/19: Symplify type specifier (not t) as nil, Andrea Corallo, 2020/12/21