Impressed

Continue to be impressed by the responsiveness of the Unicon development team.

Unicon is building up toward release 13. The beta working copies in SVN are used to build up this document set, and rarely fail to deliver.

I’ve put in a few bug reports for edge case failures, and all the critical ones have been fixed in well under an 8 hour window. Much kudos to the team.

Jafar Al-Gharaibeh and Clinton Jeffery are two highly productive and engaged developers. Nice to be following.

Some examples: take a look at https://sourceforge.net/p/unicon/bugs/202/ and https://sourceforge.net/p/unicon/bugs/200/. The first, a segfault issue, and the other a beta work in progress build failure. Both fixed within 3 hours of reporting. Nice. And this is on top of all the other code and documentation commits that are happening. Nicer.

The UP docs

This Unicon Programming doc set is progressing along nicely. Happy to have taken on the task. There are so many features in Unicon that it is a complete pleasure to add each new entry. Every sit down is a joy.

Unicon is both practical, and deep. A single expression chain can be a wonder to behold, and sometimes a challenge to come up with just the right idiomatic Unicon. Not hard, per se, but immensely satisfying. Do you add an if or use a conjunction? Separate out an assignment or chain it inside an indexing operation? When things need to get done, they get done, but there are times when pondering a single line, polishing and crafting, is more than half the fun. A sensation that I’d guess the great authors experience when the sentence just seems perfect. (Or perhaps the pleasure and pain, and the angst, when the right combination of words seems just out of reach, only to suddenly appear on the page, with a sigh of relief and a smile.)

Unit testing

Along with some experiments with inline expression evaluation, using Tasks and multi-tasking loadable co-expressions, I’ve started in on a small Unicon unit testing framework. So far, some few 140 lines of framework code is allowing for simple unit test passes. For example:

##-
# Author: Brian Tiffin
# Dedicated to the public domain
#
# Date: September 2016
# Modified: 2016-10-23/05:11-0400
##+
#
# literate.icn, Unit testing, in source
#

$ifndef UNITTEST
##
# unit testing experiment
procedure main()
    write("compile with unicon -DUNITTEST for the real show")
end

$else
link unittest
##
# unit test trial
procedure main()
    ##-
    #
    #
    #
    ##+
    speaktest := 1
    looplimit := -1
    test("1 + 2")
    test("return 1 + 2", 3)
    test("return 1 + 2", 0)
    test("return write(1 + 2)", 3, "3\n")
    tests("suspend 1 to 3", [1,2,3])
    tests("syntaxerror 1 to 3", [1,2,3])
    looplimit := 4
    tests("suspend seq()\\5", [1,2,3,4,5])
    tests("suspend seq()\\4", [1,2,3,4])
end
$endif

$ifdef DOC
===================
Unicon unit testing
===================

- test(code, result, output, errorout) - singleton
- tests(code, result, output, errorout) - generators

Set ``speaktest`` to non-null for verbose reporting
Set ``looplimit`` to a reasonable value for infinite loop break.
$endif

../programs/unitest/literate.icn

Sample run:

prompt$ unicon -s -DUNITTEST literate.icn -x
################## Test:    1 ##################
1 + 2
Trials: 1 Errors: 0  Pass: 1 Fail: 0
################################################

################## Test:    2 ##################
return 1 + 2
Expecting: 3
Received: integer, 3
Trials: 2 Errors: 0  Pass: 2 Fail: 0
################################################

################## Test:    3 ##################
return 1 + 2
Expecting: 0
Received: integer, 3
Trials: 3 Errors: 0  Pass: 2 Fail: 1
################################################

################## Test:    4 ##################
return write(1 + 2)
Expecting: 3
3
Received: integer, 3
Trials: 4 Errors: 0  Pass: 3 Fail: 1
################################################

######## Generator test:    1 ##################
suspend 1 to 3
Expecting: [1,2,3]
Received: [1,2,3]
Trials: 1  Errors: 0  Breaks: 0  Pass: 1 Fail: 0
################################################

######## Generator test:    2 ##################
syntaxerror 1 to 3
Expecting: [1,2,3]
Received: []
Trials: 2  Errors: 1  Breaks: 0  Pass: 1 Fail: 0
################################################

######## Generator test:    3 ##################
suspend seq()\5
Expecting: [1,2,3,4,5]
fail lequiv 4
Received: [1,2,3,4]
Trials: 3  Errors: 1  Breaks: 1  Pass: 1 Fail: 1
################################################

######## Generator test:    4 ##################
suspend seq()\4
Expecting: [1,2,3,4]
Received: [1,2,3,4]
Trials: 4  Errors: 1  Breaks: 1  Pass: 2 Fail: 1
################################################

This will be worked on, on the side, to see if it can’t be made xUnit and/or TAP compatible, with possible XML reporting features to allow for future Unicon programs to take part in Jenkins style auto build setups.

Have good, test well.

Previous: Unicon loadfunc   Next: Invited