Re: how exactly to do unit testing in scheme...

2018-01-30 Thread Robert Merkel
Sorry for the tardy response - I went away for the long weekend and was
busy yesterday!

As Phil says, you can test both leaf functions and controller code with
unit tests. With controller code, you may need to write mocks for some or
all of the called code.  I don't know whether there are prewritten mocking
libraries for guile, but given the extreme flexibility of scheme it
shouldn't be difficult to write code to replace one function call with
another where necessary.

As long as xaccTransGetDate and xaccSplitGetParent are adequately tested,
there is no particular reason from a testing perspective to throw in an
intermediate function.

As far as which options to test, if testing all the combinations
exhaustively results in too many tests (and it sounds like it does) try
pairwise combinatoric testing, which works as follows:

Say you've got options {o_1, o_2, o_3, ... o_n}, each of which can take a
limited set of values {o_i^1, o_i_2, o_i^k} (for instance, if the option
can either be "on" or "off" it has two values).

For any pair of options o_x and o_y, for all the possible combinations of
option values there should be at least one test that has that combination.

To give a very simple case, for three options {a, b, c}  each of which can
take two values {off, on}, you could have the following tests:

 Option   a b c
Test
1 off  off   off
2 off   on  off
3 on   off   on
4 onon  off
5 off   offon

For the pair (a,b) tests 1 through 4 give all the possible combinations,
for the pair (a, c) tests {1, 3, 4, 5} give all the possible combinations,
and for the pair (b, c) tests {1, 2, 3, 4} give all the possible
combinations.

5 is the minimum number of tests that can meet the pairwise combinatoric
criterion, as compared to 8 if you tried all the possible combinations.
However, it becomes an even bigger win if you're trying lots of options:
you only need 9 tests for 8 options with two values, whereas you would need
256 tests to try every possible option combination!

To generate optimal pairwise test sets, you can use "jenny" (this is a
really useful but unmaintained tool, I really should take over the
maintenance):

http://burtleburtle.net/bob/math/jenny.html

Hope this helps, and feel free to ask more questions.  I will try to
respond more promptly!


On Thu, Jan 25, 2018 at 3:03 AM, Christopher Lam 
wrote:

> Dear Devel
>
>
>
> To rgmerk: Welcome back, and it was a nice to meet irl!
>
>
>
> While simplifying transaction.scm and thinking of unit testing, I now have
> a conundrum worthy of an expert view.
>
>
>
> The reports require 2 main functions – the options generator and the
> renderer; the options generator generates a options.scm controller object,
> and the renderer takes options and outputs html.
>
>
>
> I understand unit testing to handle testing of ‘leaf’ functions e.g.
> (split->date), rather than the controller code (e.g. renderer takes options
> and outputs html) – but to me this is rather silly because split->date only
> tests xaccTransGetDate and xaccSplitGetParent, whereas the controller tests
> actual functionality.
>
>
>
> With regards to unit testing I can see several issues
>
>
>
>1. The refactored report has inlined most single-use functions into
>lambda expressions – I figured that directly stating (xaccTransGetDate
>(xaccSplitGetParent split)) is much more descriptive to a programmer than
>to create a testable leaf function (split->date split). I can see the
>benefits of both – leave as lambda expressions which will can be
>understandable by anyone who is familiar with the API, or break them out
>into 100s of single use functions which can be tested, but introduces a
>whole layer of cognitive load to anyone hacking code – (what does
>split->date actually do? Where is its definition). Also, breaking the
>lambda functions into testable functions means the implementation is frozen
>and the next hacker will have lesser scope to rework/optimise the report.
>
>
>
>1. The refactored report is now flexible enough to accommodate derived
>reports with a different multicolumn data function – eg
>income-gst-statement.scm has been reworked into a transaction.scm
>derivative which passes its own calculated-cells to report on GST sales and
>purchases. This is not yet committed.
>
>
>
>1. I think the most useful testing approach for a complex
>transaction.scm will be to test functions of various combinations of
>options values, and test the resulting html for satisfactory output. There
>are now dozens of bools and multichoices that can be triggered, each
>effecting html in various ways. How best to test?
>
>
>
>1. My view would be the unit test would check that:
>   1. the TR actually exists
>   2. it can display empty-report
>   3. it can understand passing of 

Re: What version of txf export used in windows version 2.6.19

2018-01-30 Thread Alex Aycinena
> -- Forwarded message --
> From: Jeffrey Black 
> To: gnucash-devel@gnucash.org
> Cc:
> Bcc:
> Date: Sat, 27 Jan 2018 18:13:02 -0700 (MST)
> Subject: What version of txf export used in windows version 2.6.19
> I tried importing my txf output file into H block Premium 2017, hoping it
> works this year.  It doesn't.  I know they have a problem with importing,
> it
> creates multiple copies of schedules C and F.  That is their problem not
> GnuCash.
>
> I am under U.S. 1040 tax code.  Using windows version 2.6.19 of GnuCash.
>
> 3 questions.
>
> 1)  Looking in the txf.scm file it looks like you are using V42 not V41
> from
> the date fields. IE.
>
> (cons 'N370 #(none "Sched F" "Custom hire (machine work)" 1 #t ""
> ((2012
> "7") (2011 "7a or b") (1990 "9"
>
> Which version is it actually exporting?  V41 or V42?  The header says V41.
>
>
The latest version as of the report re-write was V41, dated 6/16/06, which
was used. The dates you see are used for the report formatting and have
nothing to do with the TXF output or the version of the txf spec. It has
not been updated, yet, to version 42 because I did not know of it until
just now.



> 2)  Also, there is very little information available about the internal
> format of a .TXF file.  In Windows, does it matter if each line with data
> ends in a carriage return , then followed by a blank line of only
>  ?IE:
>
> V041
> 
> AGnuCash 2.6.19
> 
> D01/26/2018
> 
> ^
> etc..
>
>
I don't know the answer to that specifically. When the report was first
re-written there was a problem initially on the Windows platform with line
endings that was fixed and tested by the user on Windows that reported the
problem. I don't recall what tax software he used. You could test the
relevance of the blank lines by using a text editor with a small sample to
try different combinations and see if you get different results.



> 3)  there are only 685 codes in V041 and 717 codes in Version 042, all 3
> digits.  Where did you find the codes with four digits?
>
>
There is a TXF Spec for Business "Business Tax Exchange Format for Forms
1065, 1120, 1120S, 990, 990-PF, 990-T", V41, that was used.



>
>
> --JEffrey Black M.B.A.
>


 Regards,

Alex
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Building unstable on Mac

2018-01-30 Thread Geert Janssens
Op dinsdag 30 januari 2018 17:50:01 CET schreef Aaron W. Swenson:
> On 2018-01-29 20:02, John Ralls wrote:
> > To build unstable:
> > …
> > 7. make && make install
> > 
> > To run tests, run
> > 
> >   make check
> 
> Are these really correct? I thought all of that got stripped out.

Those are correct.

We removed autotools support in favor of cmake. That means autogen.sh and 
configure are gone. However cmake by default also creates makefiles to be used 
with the make command.

Geert



___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Access to code.gnucash.org

2018-01-30 Thread Adrien Monteleone
Certainly that is preferred when typing a link, but is the server not set up to 
force TLS? (not just a redirect)

Regards,
Adrien

> On Jan 30, 2018, at 10:40 AM, Derek Atkins  wrote:
> 
> John Ralls  writes:
> 
>> Yes, only core developers have the ssh keys neededto access
>> code.gnucash.org . Since not all of the core
> 
> Just a quick suggestion that this should be https://  and not http://
> 
> -derek
> 
> -- 
>   Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
>   Member, MIT Student Information Processing Board  (SIPB)
>   URL: http://web.mit.edu/warlord/PP-ASEL-IA N1NWH
>   warl...@mit.eduPGP key available
> ___
> gnucash-devel mailing list
> gnucash-devel@gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel

___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Building unstable on Mac

2018-01-30 Thread Aaron W. Swenson
On 2018-01-29 20:02, John Ralls wrote:
> To build unstable:
> …
> 7. make && make install
> 
> To run tests, run 
>   make check

Are these really correct? I thought all of that got stripped out.


signature.asc
Description: Digital signature
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Access to code.gnucash.org

2018-01-30 Thread Derek Atkins
John Ralls  writes:

> Yes, only core developers have the ssh keys neededto access
> code.gnucash.org . Since not all of the core

Just a quick suggestion that this should be https://  and not http://

-derek

-- 
   Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
   Member, MIT Student Information Processing Board  (SIPB)
   URL: http://web.mit.edu/warlord/PP-ASEL-IA N1NWH
   warl...@mit.eduPGP key available
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Which doc directory

2018-01-30 Thread Robert Fewell
Hi,

I have two usr/share/doc directories related to Gnucash, they are...

/usr/share/doc/Gnucash with Changelogs... and HACKING,NEWS etc...
/use/share/doc/gnucash with abc.qif, web.qif etc...

I am not sure which is correct but the doc\CMakeLists,txt is pointing to
'doc/gnucash' while the main CMakeLists.txt is using CMAKE_INSTALL_DOCDIR.

Regards,

  Bob
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel