Empty strings are not equal to any number, so all comparisons against

them fail except for tests for non-equalness.
This commit is contained in:
Mike McCormack 2005-11-14 12:29:10 +00:00 committed by Alexandre Julliard
parent a8d9a2a4ac
commit deaae4b8d1
2 changed files with 28 additions and 2 deletions

View File

@ -194,12 +194,18 @@ boolean_factor:
| symbol_s operator value_i
{
int num;
$$ = num_from_prop( $1, &num ) && compare_int( num, $2, $3 );
if (num_from_prop( $1, &num ))
$$ = compare_int( num, $2, $3 );
else
$$ = ($2 == COND_NE || $2 == COND_INE );
}
| value_i operator symbol_s
{
int num;
$$ = num_from_prop( $3, &num ) && compare_int( $1, $2, num );
if (num_from_prop( $3, &num ))
$$ = compare_int( $1, $2, num );
else
$$ = ($2 == COND_NE || $2 == COND_INE );
}
| symbol_s operator symbol_s
{

View File

@ -599,6 +599,24 @@ void test_condition(void)
r = MsiEvaluateCondition(hpkg, "bandalmael=0");
ok( r == MSICONDITION_FALSE, "wrong return val\n");
r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
ok( r == MSICONDITION_TRUE, "wrong return val\n");
r = MsiEvaluateCondition(hpkg, "bandalmael<0");
ok( r == MSICONDITION_FALSE, "wrong return val\n");
r = MsiEvaluateCondition(hpkg, "bandalmael>0");
ok( r == MSICONDITION_FALSE, "wrong return val\n");
r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
ok( r == MSICONDITION_FALSE, "wrong return val\n");
r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
ok( r == MSICONDITION_FALSE, "wrong return val\n");
r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
ok( r == MSICONDITION_TRUE, "wrong return val\n");
MsiSetProperty(hpkg, "bandalmael", "0" );
r = MsiEvaluateCondition(hpkg, "bandalmael=0");
ok( r == MSICONDITION_TRUE, "wrong return val\n");
@ -646,6 +664,8 @@ void test_condition(void)
MsiSetProperty(hpkg, "bandalmael", "0.0" );
r = MsiEvaluateCondition(hpkg, "bandalmael=0");
ok( r == MSICONDITION_FALSE, "wrong return val\n");
r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
ok( r == MSICONDITION_TRUE, "wrong return val\n");
MsiCloseHandle( hpkg );
}