<font size=2 face="sans-serif">Hello</font><br><br><font size=2 face="sans-serif">The following test case, that currently
fails on Linux, &nbsp;is extracted from some of the excluded tests inside
TestFoundation/TestNSRegularExpression. </font><br><br><font size=2 face="sans-serif">import Foundation</font><br><br><font size=2 face="sans-serif">let searchStr = &quot;123&quot;</font><br><font size=2 face="sans-serif">let testRegex = try NSRegularExpression.init(pattern:
&quot;a(b|c|d)(x|y|z)*|123&quot;, options: [])</font><br><font size=2 face="sans-serif">let firstMatch = testRegex.firstMatchInString(searchStr,
options: [], range: NSMakeRange(0,3))</font><br><br><font size=2 face="sans-serif">if NSEqualRanges((firstMatch!.rangeAtIndex(1),
NSMakeRange(NSNotFound,0)) {</font><br><font size=2 face="sans-serif">&nbsp; &nbsp; print(&quot;Test passed&quot;)</font><br><font size=2 face="sans-serif">} else {</font><br><font size=2 face="sans-serif">&nbsp; &nbsp; print(&quot;First match
first capture range = \(NSStringFromRange(firstMatch!.rangeAtIndex(1)))&quot;)</font><br><font size=2 face="sans-serif">&nbsp; &nbsp; print(&quot;Test failed&quot;)</font><br><font size=2 face="sans-serif">}</font><br><br><br><br><font size=2 face="sans-serif">In the above scenario, no capture group
participates in the match. So, firstMatch.rangeAtIndex(1) should ideally
return range {NSNotFound, 0} but the actual returned value is range {-1,
0}. Hence the failure.</font><br><br><font size=2 face="sans-serif">Debugging on the CoreFoundation, it
is observed that the value -1 is coming from 'kCFNotFound' which is defined
as -1. On the Foundation side, 'NSNotFound' is defined with the value of
‘Int.max’ (which must be Int32.max and Int64.max on 32 and 64 bit platforms
respectively).</font><br><br><font size=2 face="sans-serif">There are a couple of queries that I
have:</font><br><br><font size=2 face="sans-serif">-&gt; Is 'NSNotFound' in Foundation
mapped &nbsp;to 'kCFNotFound' &nbsp;in CoreFoundation?</font><br><br><font size=2 face="sans-serif">-&gt; If so, then why do 'NSNotFound'
and 'kCFNotFound' have different values on the Foundation and CoreFoundation
respectively?</font><br><br><font size=2 face="sans-serif">Also, I tested by modifying the 'kCFNotFound'
value in CoreFoundation/Base.subproj/CFBase.h &nbsp;(See below code snippet):</font><br><br><font size=2 face="sans-serif">#if TARGET_RT_64_BIT</font><br><font size=2 face="sans-serif">static const CFIndex kCFNotFound = LONG_MAX;</font><br><font size=2 face="sans-serif">#else</font><br><font size=2 face="sans-serif">static const CFIndex kCFNotFound = INT_MAX;</font><br><font size=2 face="sans-serif">#endif</font><br><br><br><font size=2 face="sans-serif">With this change the above mentioned
test-case passes but a lot of other TestFoundation tests seem to fail.</font><br><br><font size=2 face="sans-serif">Please provide your comments on the
appropriate change that is needed here. </font><br><br><font size=2 face="sans-serif">Thank you.</font><br><br><font size=2 face="sans-serif">Regards</font><br><font size=2 face="sans-serif">Mamatha</font><br><table width=600 style="border-collapse:collapse;"><tr height=8><td width=600 colspan=4 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><hr><tr height=8><td width=600 colspan=4 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><tr height=8><td width=350 colspan=2 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=2 face="Arial"><b>Mamatha
Busi</b></font><td width=129 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><td width=119 rowspan=3 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><div align=right><img src=cid:_1_10971D9C109719C80041A24165257F6A style="border:0px solid;"></div><tr height=8><td width=350 colspan=2 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">Java
L3 Support</font><td width=129 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><tr height=8><td width=350 colspan=2 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">IBM
Software Group</font><td width=129 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">&nbsp;</font><tr height=8><td width=350 colspan=2 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">India
Software Labs</font><td width=129 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">&nbsp;
</font><td width=119 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><tr height=8><td width=75 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><td width=275 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><td width=129 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">&nbsp;
</font><td width=119 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><tr height=8><td width=75 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><td width=275 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><td width=129 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">&nbsp;
</font><td width=119 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><tr height=8><td width=75 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">e-mail:</font><td width=275 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">mamabusi@in.ibm.com</font><td width=129 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">&nbsp;
</font><td width=119 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><tr height=8><td width=350 colspan=2 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><a href=http://bit.ly/a7KpQj><font size=1 color=blue face="Arial"><u>Java
Technology India Group</u></font></a><td width=129 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><font size=1 color=#5f5f5f face="Arial">&nbsp;
</font><td width=119 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><tr height=8><td width=600 colspan=4 style="border-style:none none none none;border-color:#000000;border-width:0px 0px 0px 0px;padding:0px 0px;"><hr></table><br><font size=2 face="sans-serif"><br></font><BR>