Priority: Not specified
Affects Version/s: None
Fix Version/s: 6.4.0
Some strange behaviour by MAP function.Running:
FilePath := 'MyTestFile';
MyFile := Files.LoadCsvFile(FilePath, FileLayout);
y := MyFile.MyValue;
UseMap(UTF8 myValue) := FUNCTION
myValue = U'Permanent' => 2,
//Std.Uni.CompareAtStrength(myValue, U'SomethingElse' , 5) = 0 => 4,
myValue = U'Fixed term contract' => 3,
myValue = U'Fixed Term' => 3,
UseMap( y );
returns 1 as the result.
If I uncomment the line with Std.Uni, the result is 2.
If I comment that line again, the result goes back to 1, but then I comment out line "myValue = U'Fixed term contract' => 3," and the result is 2 again. I then add another line "myValue = U'Whatever' => 5," and the result is 1 again.
y comes from a file and comparing using other methods indicates it has the value U'Permanent' and the result should always be 2. But even if I shouldn't be using "=" for unicode comparison, at least MAP should be consistent, and the result should not depend on whether an additional condition is there.
For reference, here are the other methods I used to compare:
UseCase(UTF8 myValue) := FUNCTION
U'Permanent' => 2,
U'Fixed term contract' => 3,
U'Fixed Term' => 3,
x := u'Permanent';
x = y; // true
Std.Uni.CompareAtStrength(x,y,5) = 0; // true
IF(y = U'Permanent', 2, 1); // 2
IF(Std.Uni.CompareAtStrength(x,y,5) = 0, 2, 1); // 2
UseCase( x ); // 2
UseCase( y ); // 2
UseMap( x ); // 2
So, based on all this the result of UseMap( y ) should always be 2.