diff options
author | drh <> | 2023-09-14 13:10:17 +0000 |
---|---|---|
committer | drh <> | 2023-09-14 13:10:17 +0000 |
commit | 60e53c57cf873b4a0ce486a5079a3f21cd437fc4 (patch) | |
tree | 8460959e5f69a9079e06404b3cf280c0007a30b7 /src | |
parent | dc03af67a4427542a34fd64a88a72089c2e192c1 (diff) | |
download | sqlite-60e53c57cf873b4a0ce486a5079a3f21cd437fc4.tar.gz sqlite-60e53c57cf873b4a0ce486a5079a3f21cd437fc4.zip |
Improve the sqlite3IntFloatCompare() routine so that it is testable.
FossilOrigin-Name: bb221381fa38db5be1222d89c567a9bca0e6c441e26a8c797bd326b263556afb
Diffstat (limited to 'src')
-rw-r--r-- | src/vdbeaux.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 106b8073c..eafc03856 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -4473,8 +4473,7 @@ int sqlite3IntFloatCompare(i64 i, double r){ testcase( x>r ); testcase( x==r ); if( x<r ) return -1; - if( x>r ) return +1; /*NO_TEST*/ /* work around bugs in gcov */ - return 0; /*NO_TEST*/ /* work around bugs in gcov */ + return x>r; /*NO_TEST*/ /* work around bug in gcov */ }else{ i64 y; double s; @@ -4483,10 +4482,12 @@ int sqlite3IntFloatCompare(i64 i, double r){ y = (i64)r; if( i<y ) return -1; if( i>y ) return +1; + testcase( r<(double)i ); + testcase( r>(double)i ); + testcase( r==(double)i ); s = (double)i; if( s<r ) return -1; - if( s>r ) return +1; - return 0; + return s>r; /*NO_TEST*/ /* work around bug in gcov */ } } |