Hi,
i want to build a Test-App to test self build functions. In the Windows world I use Xbase++, and Testdata in an 2 dimension Array. Xbase++ can hold different datatypes in one Array, so this is fast and easy:
I know that B4A (like other Basics etc.) can NOT mix up data types in one Array, or ?
So I thougt about using a TYPE and a Array of this TYPE for each Datarecord.
But how to geht the test data inside without typing so much source code ...
One other thing, the String parameters are often "" (String with lenght 0), this will generate runtime errors if I use this Strings. Isn't an empty string a normal string ?
I use normaly this to detect, but I got strange results:
Whats the best way to test if an string is empty without getting runtime errors.
Any hints ?
i want to build a Test-App to test self build functions. In the Windows world I use Xbase++, and Testdata in an 2 dimension Array. Xbase++ can hold different datatypes in one Array, so this is fast and easy:
B4X:
// Xbase++
aTestData := { { "String 1", 5, 31.12.2001, .t. } , ;
{ "String 2", 10, NIL, .f. } }
// One Array with 2 Datarecords, each Type ( String, Number, Date, Logical )
for x := 1 to len(aTestData) // 1 to 2 Datarecords
if aTestData[4] = MyFunc( aTestData[1],aTestData[2],aTestData[3] ) // Function Type locical
? "Test OK"
else
nError++
endif
next
if nError > 0
? "Errors",nError
endif
I know that B4A (like other Basics etc.) can NOT mix up data types in one Array, or ?
So I thougt about using a TYPE and a Array of this TYPE for each Datarecord.
B4X:
TYPE TestData( sString as String, nVal as Int, sDate as String, Expected as logical
DIM aTestData(2) as TestData ' I don't like starting with 0 ...
...
One other thing, the String parameters are often "" (String with lenght 0), this will generate runtime errors if I use this Strings. Isn't an empty string a normal string ?
I use normaly this to detect, but I got strange results:
B4X:
if sString.length = 0 ...
if sString = "" ...
Whats the best way to test if an string is empty without getting runtime errors.
Any hints ?