byte-physics / igortest

Igor Pro Universal Testing Framework
https://docs.byte-physics.de/igor-unit-testing-framework/
BSD 3-Clause "New" or "Revised" License
7 stars 2 forks source link

Invalid UTF_EXPECTED_FAILURE Tag in Igor 6 and 7 #378

Closed Garados007 closed 1 year ago

Garados007 commented 1 year ago

If I write the following test cases:

// UTF_EXPECTED_FAILURE
static Function TestCase1()
    PASS()
End

static Function TestCase2()
    // other stuff
End

Both test cases are marked as UTF_EXPECTED_FAILURE when I look into root:Packages:UnitTesting:TestRunData. This is only the case for Igor 6 and 7.

t-b commented 1 year ago

Educated guess:

In GetFunctionTagWave the function ProcedureText works differently in <= 7 and > 7.

t-b commented 1 year ago

That does not reproduce for me with IP6/7:

#pragma TextEncoding = "UTF-8"
#pragma rtGlobals=3             // Use modern global access method and strict wave access
#pragma DefaultTab={3,20,4}     // Set default tab width in Igor Pro 9 and later
#pragma version=1.09
#pragma ModuleName = module

#include "unit-testing"

// UTF_EXPECTED_FAILURE
static Function TestCase1()
    PASS()
End

static Function TestCase2()
    // other stuff
End

gives:

•print root:Packages:UnitTesting:TestRunData
  TestRunData[0][0]= {"Proc0","Proc0"}
TestRunData[0][1]= {"module#TestCase1","module#TestCase2"}
TestRunData[0][2]= {"module#TestCase1","module#TestCase2"}
TestRunData[0][3]= {"",""}
TestRunData[0][4]= {"0","0"}
TestRunData[0][5]= {"1","0"}
Garados007 commented 1 year ago

Weird. This bug appeared when working on PR #377. I'll have a deeper look into it.

Garados007 commented 1 year ago

I found the bug. We are storing the function tag in a function tag wave and setting the full name of the function as a dimension label. In Igor 6 and 7 the length of a dimension label is limited to 31 characters and everything that is longer is cut. But my full function names are longer than that:

•Print GetDimLabel(root:Packages:UnitTesting:FunctionTagWaves, 0, 0)
  TS_FailedTests#EmptyExpectedFai

My solution for the current project is to choose a shorter name but this won't solve this issue in general as we didn't check the length of the full function name. We can at least output an assertion to inform the user.

Garados007 commented 1 year ago

A cleaner version would be to use something like the short paths in windows that checks if the length of the full name is longer than 31 characters and replace it with a shorter version like TS_FailedTests#EmptyExpectedF~1 in this example. We can store the long version in a wave and use the short path as dimension label. But this is something that is only needed in Igor 6 and 7.

t-b commented 1 year ago

Good find. I think I would prefer that we store the full function name in a text wave then.

t-b commented 1 year ago

Just to clarify why I think the textwave is a better approach. Function names and Module names can both be up to 255 characters long so one can also construct test cases in IP9 which will trigger the "too short dimension label bug".

Garados007 commented 1 year ago

Function names and Module names can both be up to 255 characters long so one can also construct test cases in IP9 which will trigger the "too short dimension label bug".

Thanks for the information. I wasn't sure if we can trigger the same bug in Igor >=8.