Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions releases/ALUnit-v1.0.lsp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ SOFTWARE.
| *ALU:testSuites* - assoc list of test suites and a list of their tests
| *ALU:testsRun* - counter for total tests run in the current batch
| *ALU:failMessages* - list of messages to print after testing
| *ALU:startTime* - date number for start of testing
| *ALU:startTime* - milliseconds since boot time for start of testing
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like good stuff, but I don't think it should go in this release file. Could you create a new release file for these changes? v1.1.0 sounds right to me as this is an important change, but shouldn't break anything, right?

| *ALU:currentTestName* - name of test currently running
|;

Expand Down Expand Up @@ -392,11 +392,9 @@ SOFTWARE.
(mapcar
'(lambda (testName)
(setq *ALU:currentTestName* testName)
(foreach
testExpression
(eval
(cdr
(assoc testName *ALU:allTests*))
(eval testExpression)))
(assoc testName *ALU:allTests*))))
(cdr testSuite))
(ALU:printElapsedTime)
(ALU:printTestInfo))
Expand All @@ -415,16 +413,14 @@ SOFTWARE.
| @output: Standard ALUnit output.
|;

(defun runTest ( testName / testExpression)
(defun runTest ( testName )
(ALU:resetTestInfo)
(ALU:printOutputHeader)
(ALU:startTimer)
(setq *ALU:currentTestName* testName)
(foreach
testExpression
(eval
(cdr
(assoc testName *ALU:allTests*))
(eval testExpression))
(assoc testName *ALU:allTests*)))
(ALU:printElapsedTime)
(ALU:printTestInfo)
(print))
Expand Down Expand Up @@ -477,7 +473,7 @@ SOFTWARE.
(defun ALU:startTimer ( / )
(setq
*ALU:startTime*
(getvar "date"))
(getvar "millisecs"))
(princ))


Expand All @@ -486,20 +482,16 @@ SOFTWARE.
| @output: Elapsed time in milliseconds.
|;

(defun ALU:printElapsedTime ( / MILLISEC_CONVERSION DECIMAL_FORMAT
ZERO_DECIMAL_PLACES)
(setq MILLISEC_CONVERSION 86400000
DECIMAL_FORMAT 2
(defun ALU:printElapsedTime ( / DECIMAL_FORMAT ZERO_DECIMAL_PLACES)
(setq DECIMAL_FORMAT 2
ZERO_DECIMAL_PLACES 0)
(princ
(strcat
"\nTime: "
(rtos
(*
MILLISEC_CONVERSION
(-
(getvar "date")
*ALU:startTime*))
(-
(getvar "millisecs")
*ALU:startTime*)
DECIMAL_FORMAT
ZERO_DECIMAL_PLACES)
" ms"))
Expand Down
32 changes: 12 additions & 20 deletions src/Test.lsp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
| *ALU:testSuites* - assoc list of test suites and a list of their tests
| *ALU:testsRun* - counter for total tests run in the current batch
| *ALU:failMessages* - list of messages to print after testing
| *ALU:startTime* - date number for start of testing
| *ALU:startTime* - milliseconds since boot time for start of testing
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't test these timing change now, but this seems like a good approach. Nice work!

| *ALU:currentTestName* - name of test currently running
|;

Expand Down Expand Up @@ -110,11 +110,9 @@
(mapcar
'(lambda (testName)
(setq *ALU:currentTestName* testName)
(foreach
testExpression
(eval
(cdr
(assoc testName *ALU:allTests*))
(eval testExpression)))
(assoc testName *ALU:allTests*))))
(cdr testSuite))
(ALU:printElapsedTime)
(ALU:printTestInfo))
Expand All @@ -133,16 +131,14 @@
| @output: Standard ALUnit output.
|;

(defun runTest ( testName / testExpression)
(defun runTest ( testName )
(ALU:resetTestInfo)
(ALU:printOutputHeader)
(ALU:startTimer)
(setq *ALU:currentTestName* testName)
(foreach
testExpression
(eval
(cdr
(assoc testName *ALU:allTests*))
(eval testExpression))
(assoc testName *ALU:allTests*)))
(ALU:printElapsedTime)
(ALU:printTestInfo)
(print))
Expand Down Expand Up @@ -195,7 +191,7 @@
(defun ALU:startTimer ( / )
(setq
*ALU:startTime*
(getvar "date"))
(getvar "millisecs"))
(princ))


Expand All @@ -204,20 +200,16 @@
| @output: Elapsed time in milliseconds.
|;

(defun ALU:printElapsedTime ( / MILLISEC_CONVERSION DECIMAL_FORMAT
ZERO_DECIMAL_PLACES)
(setq MILLISEC_CONVERSION 86400000
DECIMAL_FORMAT 2
(defun ALU:printElapsedTime ( / DECIMAL_FORMAT ZERO_DECIMAL_PLACES)
(setq DECIMAL_FORMAT 2
ZERO_DECIMAL_PLACES 0)
(princ
(strcat
"\nTime: "
(rtos
(*
MILLISEC_CONVERSION
(-
(getvar "date")
*ALU:startTime*))
(-
(getvar "millisecs")
*ALU:startTime*)
DECIMAL_FORMAT
ZERO_DECIMAL_PLACES)
" ms"))
Expand Down