gianfrancoalongi / aplunit Goto Github PK
View Code? Open in Web Editor NEWAPLUnit - a library to facilitate Unit Testing and Test Driven Development of code written in Dyalog APL, developed together with Morten Kromberg (CTO Dyalog Ltd)
APLUnit - a library to facilitate Unit Testing and Test Driven Development of code written in Dyalog APL, developed together with Morten Kromberg (CTO Dyalog Ltd)
Current tests appear to run in a roughly alphabetical order. It would be good if a choice could be made to allow lexicographical ordering that preserves numbers in the names, as well as an in place ordering option which runs them in the order in which they appear in the file where they are defined.
The current approach to handling expected exception tests is to compare them against the result obtained from ⎕DM
. Specifically:
Z←(↑⎕DM)1
:If exception≢⍬
expect←exception
Z[2]←0
t←⎕TS-t
:EndIf
There's an issue here. ↑⎕DM
will be a matrix containing line information and so forth. This is used when doing the reporting to give more information about where the error has occurred inside of the test, and helps when you are not dealing with expected exception tests. However, if you do expect an exception, it's not a good idea to require that the entire line information be included as a part of the expected error. Instead, either the short error message 0⊃⎕DM
or the actual trapped error signal should suffice. This improves the ease of writing these tests, and makes them more robust against changes in source code which do not actually change the substantive behavior of the program.
I am not sure what the best way to handle this is.
It shall be possible to express not equal expectation
Thus, succeeding if the return value does not match #.UT.expect_not
There are indexing problems when []IO is 0.
It would be nice not having to depend on DISPLAY for this lib.
So the user will only load this code and nothing else.
What could it be exchanged for?
DOMAIN ERROR: Bad parameter specification: ⎕NA errored at * <0t - invalid type letter
is_dir[4] 'gfa'⎕NA'I kernel32|GetFileAttributes* <0t'
∧
When executing the UT.dyalog regression tests, the tests fail on execution of tests
from a directory.
Namely this test
UTres←#.UT.run'./Pages/'
Z,←⍬≡UTres
The reason is that the Linux/Windows branching does not take into account that the Version name would be different for the 64bit architecture.
The function https://github.com/Gianfrancoalongi/APLUnit/blob/master/UT.dyalog#L79 could have a more litterate function name.
Suggestion: determine_pass_or_fail
It would be nice to enable the skipping of some tests.
It shall be possible to express Pre Test setup and Post Test teardown functions.
When the tests crash, you only see the error message. Would like to see everything that ↑⎕DM gives.
It is currently not possible to cover functions in a file when running the file-path version of
unit test execution.
Conf ← ⎕NEW UTcover
Conf.pages ← '/home/APL/coverage'
Conf.cover ← ⊂ '#.UTFile.plus_function'
Conf UT.run '/path/to/file/File.dyalog'
Will not cover the plus_function in the UTFile NameSpace in the file File.dyalog.
APLUnit crashes with a very ugly message if there are no tests found in the files.
Loaded: #.UT
Loaded: #.ec
NONCE ERROR
execute_function[2] function←(⍕(⊃ut_data[1])),'.',⊃ut_data[2]
instead - it should report no tests found.
It is not clear how this library is licensed. I'd like to use it in an open-source project of mine, but I can't be comfortable doing so until it has an explicit license.
So...please add a license file of your choice.
For the APL Timebooking project - there seems to be a problem when activating coverage
C ← ⎕NEW #.UT.UTcover
C.pages ← '/tmp/'
C.cover ← ⊂ '#.Booking.indices_of_slots_with_all_musts_and_maximizing_could'
C #.UT.run '/home/gianfranco/APL/apl-timebooking/booking_tests.dyalog'
/home/gianfranco/APL/apl-timebooking/booking_tests.dyalog tests
⍋ Passed: 19
⍟ Crashed: 0
⍒ Failed: 0
inactive CPU 8.413408858E¯14 8.413408858E¯14
DOMAIN ERROR: Argument must be a symbol name
generate_coverage_page[2] CoverResults←{ProfileData generate_cover_result ⍵(⎕CR ⍵)}¨CoverConf.Cover
^
All paths which are pointing to a directory for use, SHALL be / terminated.
This shall be reflected in the documentation.
{⍵.(Passed Crashed Failed)}¨something
=> something.(Passed Crashed Failed)
On failure, there are cases where the expected and got text seems to be off in some way.
I have seen it happen when the displayed version of the Got is large.
I will provide an exact example of this.
It's useful to load the test library in a sub-namespace and not the root. This will allow easier use within more complex projects.
Measure the time for each test and the grand total.
t←⎕TS
⎕TS-t
As suggested by Jake Jacob
At the moment, when detailing which function to cover, it is only possible to target
functions from the namespace in which the UT tests have been defined.
It should be possible to target ${FUNCTION} for coverage with a ${NAMESPACE}
Conf.cover ← ⊂ '#${NAMESPACE}.${FUNCTION}'
Using classes is not really very "functional" as was envisioned.
Having succumbed to them for the use of the structure, it would be nice
picking up the idea of using something simple instead and not making any modifications through references.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.