[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 3fa73fa 2/2: Add a compiler hint test
From: |
Andrea Corallo |
Subject: |
feature/native-comp 3fa73fa 2/2: Add a compiler hint test |
Date: |
Mon, 25 May 2020 17:26:35 -0400 (EDT) |
branch: feature/native-comp
commit 3fa73fa0fb1caedd10553d9f3185635c039319fd
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>
Add a compiler hint test
Test that compiler hints are executed transparently.
* test/src/comp-tests.el (comp-tests-type-hints): New test.
* test/src/comp-test-funcs.el (comp-tests-hint-fixnum-f)
(comp-tests-hint-cons-f): New functions.
---
test/src/comp-test-funcs.el | 6 ++++++
test/src/comp-tests.el | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el
index 9fcc132..5e04be4 100644
--- a/test/src/comp-test-funcs.el
+++ b/test/src/comp-test-funcs.el
@@ -50,6 +50,12 @@
(defun comp-tests-cons-cdr-f (x)
(cdr (cons 'foo x)))
+(defun comp-tests-hint-fixnum-f (n)
+ (1+ (comp-hint-fixnum n)))
+
+(defun comp-tests-hint-cons-f (c)
+ (car (comp-hint-cons c)))
+
(defun comp-tests-varset0-f ()
(setq comp-tests-var1 55))
(defun comp-tests-varset1-f ()
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index c07c92a..3e40dba 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -194,6 +194,12 @@ Check that the resulting binaries do not differ."
(should-error (comp-tests-fixnum-minus-f 'a)
:type 'wrong-type-argument))
+(ert-deftest comp-tests-type-hints ()
+ "Just test compiler hints are transparent in this case."
+ ;; FIXME we should really check they are also effective.
+ (should (= (comp-tests-hint-fixnum-f 3) 4))
+ (should (= (comp-tests-hint-cons-f (cons 1 2)) 1)))
+
(ert-deftest comp-tests-arith-comp ()
"Testing arithmetic comparisons."
(should (eq (comp-tests-eqlsign-f 4 3) nil))