View Issue Details

IDProjectCategoryView StatusLast Update
0006000Talermechant backendpublic2020-05-01 19:57
ReporterChristian GrothoffAssigned ToMarcello Stanisci 
PrioritynormalSeveritytweakReproducibilityN/A
Status assignedResolutionopen 
Platformi7OSDebian GNU/LinuxOS Versionsqueeze
Product Versiongit (master) 
Target Version0.8Fixed in Version 
Summary0006000: test case logic is messy
DescriptionFlorian wrote:
I've quoted a *partial* example below,of some multi-screen macro in a
test case. This raises so many questions:

* why does the macro have varargs when they are not used?
* why are there local variables in the macro?
* WTF is this a macro and not a function? it's used only once ...
* why is *everything* defined in a big string? Why don't we have helper
function that take a literal struct that describes the data and then
generates the contract terms? This is such an unreadable,
unmaintainable mess right now.

The old currency format used to look like this, in many places:

  \"pay_deadline\":\"\\/Date(99999999999)\\/\",\

Again raising the questions of:
 * did nobody think that maybe the quoting required here is a bit
excessive and should be somehow factored out? There are dozens of lines
like this.
 * why is there this magic constant, should't "/never/" or { t_ms:
"never" } work instead of some arbitary constant?

Marcello, since I'm super busy with updating some other stuff that's
critical for the congress demo, please update the test cases.

For now, just make sure that it works. But long term, we need to
untangle this mess.

- Florian


#define ALLOCATE_ORDERS(...) \
  char *order_worth_5; \
  char *order_worth_5_track; \
  char *order_worth_5_unaggregated; \
  char *order_worth_10_2coins; \
  \
  GNUNET_asprintf \
    (&order_worth_5, \
    "{\"max_fee\":\
       {\"currency\":\"%s\",\
        \"value\":0,\
        \"fraction\":50000000},\
       \"refund_deadline\": { \"t_ms\": 0 },\
       \"pay_deadline\": { \"t_ms\": 99999999999 },\
       \"amount\":\
         {\"currency\":\"%s\",\
          \"value\":5,\
          \"fraction\":0},\
        \"summary\": \"merchant-lib testcase\",\
        \"fulfillment_url\": \"https://example.com/\",\
        \"products\": [ {\"description\":\"ice cream\",\
                         \"value\":\"{%s:5}\"} ] }", \
    currency, \
    currency, \
    currency); \

[ goes on like this for many more lines ]
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2019-12-20 10:27 Christian Grothoff New Issue
2019-12-20 10:27 Christian Grothoff Status new => assigned
2019-12-20 10:27 Christian Grothoff Assigned To => Marcello Stanisci
2020-03-29 22:08 Christian Grothoff Target Version 0.7.1 => 0.7.2
2020-05-01 19:57 Christian Grothoff Target Version 0.7.2 => 0.8