diff --git a/Makefile b/Makefile index 2fba006532..358354328d 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,7 @@ $(SQLITE_OUT)/sqlite3.o : $(SQLITE_UNPACKED) -DSQLITE_ENABLE_RTREE \ -DSQLITE_ENABLE_STAT4 \ -DSQLITE_ENABLE_DBSTAT_VTAB \ + -DSQLITE_ENABLE_MATH_FUNCTIONS \ -DSQLITE_THREADSAFE=1 \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DEFAULT_FILE_PERMISSIONS=0666 \ diff --git a/src/main/ext/extension-functions.c b/src/main/ext/extension-functions.c index 7e374d5e67..b513fe0267 100644 --- a/src/main/ext/extension-functions.c +++ b/src/main/ext/extension-functions.c @@ -355,6 +355,7 @@ static void name(sqlite3_context *context, int argc, sqlite3_value **argv){\ }\ +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS /* ** Example of GEN_MATH_WRAP_DOUBLE_1 usage ** this creates function sqrtFunc to wrap the math.h standard function sqrt(x)=x^0.5 @@ -365,6 +366,7 @@ GEN_MATH_WRAP_DOUBLE_1(sqrtFunc, sqrt) GEN_MATH_WRAP_DOUBLE_1(acosFunc, acos) GEN_MATH_WRAP_DOUBLE_1(asinFunc, asin) GEN_MATH_WRAP_DOUBLE_1(atanFunc, atan) +#endif /* ** Many of systems don't have inverse hyperbolic trig functions so this will emulate @@ -378,7 +380,9 @@ static double acosh(double x){ } #endif +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS GEN_MATH_WRAP_DOUBLE_1(acoshFunc, acosh) +#endif #ifndef HAVE_ASINH static double asinh(double x){ @@ -386,7 +390,9 @@ static double asinh(double x){ } #endif +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS GEN_MATH_WRAP_DOUBLE_1(asinhFunc, asinh) +#endif #ifndef HAVE_ATANH static double atanh(double x){ @@ -394,7 +400,9 @@ static double atanh(double x){ } #endif +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS GEN_MATH_WRAP_DOUBLE_1(atanhFunc, atanh) +#endif /* ** math.h doesn't require cot (cotangent) so it's defined here @@ -403,9 +411,12 @@ static double cot(double x){ return 1.0/tan(x); } +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS GEN_MATH_WRAP_DOUBLE_1(sinFunc, sin) GEN_MATH_WRAP_DOUBLE_1(cosFunc, cos) GEN_MATH_WRAP_DOUBLE_1(tanFunc, tan) +#endif + GEN_MATH_WRAP_DOUBLE_1(cotFunc, cot) static double coth(double x){ @@ -422,7 +433,9 @@ static double sinh(double x){ } #endif +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS GEN_MATH_WRAP_DOUBLE_1(sinhFunc, sinh) +#endif #ifndef HAVE_COSH static double cosh(double x){ @@ -430,7 +443,9 @@ static double cosh(double x){ } #endif +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS GEN_MATH_WRAP_DOUBLE_1(coshFunc, cosh) +#endif #ifndef HAVE_TANH static double tanh(double x){ @@ -438,7 +453,9 @@ static double tanh(double x){ } #endif +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS GEN_MATH_WRAP_DOUBLE_1(tanhFunc, tanh) +#endif GEN_MATH_WRAP_DOUBLE_1(cothFunc, coth) @@ -456,9 +473,11 @@ static double log10(double x){ } #endif +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS GEN_MATH_WRAP_DOUBLE_1(logFunc, log) GEN_MATH_WRAP_DOUBLE_1(log10Func, log10) GEN_MATH_WRAP_DOUBLE_1(expFunc, exp) +#endif /* ** Fallback for systems where math.h doesn't define M_PI @@ -472,6 +491,7 @@ GEN_MATH_WRAP_DOUBLE_1(expFunc, exp) #define M_PI 3.14159265358979323846 #endif +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS /* Convert Degrees into Radians */ static double deg2rad(double x){ return x*M_PI/180.0; @@ -484,11 +504,14 @@ static double rad2deg(double x){ GEN_MATH_WRAP_DOUBLE_1(rad2degFunc, rad2deg) GEN_MATH_WRAP_DOUBLE_1(deg2radFunc, deg2rad) +#endif +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS /* constant function that returns the value of PI=3.1415... */ static void piFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ sqlite3_result_double(context, M_PI); } +#endif /* ** Implements the sqrt function, it has the peculiarity of returning an integer when the @@ -517,6 +540,7 @@ static void squareFunc(sqlite3_context *context, int argc, sqlite3_value **argv) } } +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS /* ** Wraps the pow math.h function ** When both the base and the exponent are integers the result should be integer @@ -546,6 +570,7 @@ static void powerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ } } } +#endif /* ** atan2 wrapper @@ -1703,45 +1728,51 @@ int RegisterExtensionFunctions(sqlite3 *db){ u8 needCollSeq; void (*xFunc)(sqlite3_context*,int,sqlite3_value **); } aFuncs[] = { +#ifndef SQLITE_ENABLE_MATH_FUNCTIONS /* math.h */ { "acos", 1, 0, SQLITE_UTF8, 0, acosFunc }, { "asin", 1, 0, SQLITE_UTF8, 0, asinFunc }, { "atan", 1, 0, SQLITE_UTF8, 0, atanFunc }, - { "atn2", 2, 0, SQLITE_UTF8, 0, atn2Func }, /* XXX alias */ { "atan2", 2, 0, SQLITE_UTF8, 0, atn2Func }, { "acosh", 1, 0, SQLITE_UTF8, 0, acoshFunc }, { "asinh", 1, 0, SQLITE_UTF8, 0, asinhFunc }, { "atanh", 1, 0, SQLITE_UTF8, 0, atanhFunc }, - { "difference", 2, 0, SQLITE_UTF8, 0, differenceFunc}, { "degrees", 1, 0, SQLITE_UTF8, 0, rad2degFunc }, { "radians", 1, 0, SQLITE_UTF8, 0, deg2radFunc }, { "cos", 1, 0, SQLITE_UTF8, 0, cosFunc }, { "sin", 1, 0, SQLITE_UTF8, 0, sinFunc }, { "tan", 1, 0, SQLITE_UTF8, 0, tanFunc }, - { "cot", 1, 0, SQLITE_UTF8, 0, cotFunc }, + { "cosh", 1, 0, SQLITE_UTF8, 0, coshFunc }, { "sinh", 1, 0, SQLITE_UTF8, 0, sinhFunc }, { "tanh", 1, 0, SQLITE_UTF8, 0, tanhFunc }, - { "coth", 1, 0, SQLITE_UTF8, 0, cothFunc }, { "exp", 1, 0, SQLITE_UTF8, 0, expFunc }, { "log", 1, 0, SQLITE_UTF8, 0, logFunc }, { "log10", 1, 0, SQLITE_UTF8, 0, log10Func }, { "power", 2, 0, SQLITE_UTF8, 0, powerFunc }, -#if SQLITE_VERSION_NUMBER < 3035000 - { "sign", 1, 0, SQLITE_UTF8, 0, signFunc }, -#endif + { "sqrt", 1, 0, SQLITE_UTF8, 0, sqrtFunc }, - { "square", 1, 0, SQLITE_UTF8, 0, squareFunc }, { "ceil", 1, 0, SQLITE_UTF8, 0, ceilFunc }, { "floor", 1, 0, SQLITE_UTF8, 0, floorFunc }, { "pi", 0, 0, SQLITE_UTF8, 1, piFunc }, +#endif + { "atn2", 2, 0, SQLITE_UTF8, 0, atn2Func }, + { "difference", 2, 0, SQLITE_UTF8, 0, differenceFunc}, + + { "cot", 1, 0, SQLITE_UTF8, 0, cotFunc }, + { "coth", 1, 0, SQLITE_UTF8, 0, cothFunc }, + +#if SQLITE_VERSION_NUMBER < 3035000 + { "sign", 1, 0, SQLITE_UTF8, 0, signFunc }, +#endif + { "square", 1, 0, SQLITE_UTF8, 0, squareFunc }, /* string */ { "replicate", 2, 0, SQLITE_UTF8, 0, replicateFunc }, diff --git a/src/main/resources/org/sqlite/native/FreeBSD/aarch64/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/FreeBSD/aarch64/libsqlitejdbc.so index 077da2861d..d8c2bef985 100755 Binary files a/src/main/resources/org/sqlite/native/FreeBSD/aarch64/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/FreeBSD/aarch64/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/FreeBSD/x86/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/FreeBSD/x86/libsqlitejdbc.so index fc118e108b..28f34673c5 100755 Binary files a/src/main/resources/org/sqlite/native/FreeBSD/x86/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/FreeBSD/x86/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/FreeBSD/x86_64/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/FreeBSD/x86_64/libsqlitejdbc.so index a1aab5b82e..90d7772d2d 100755 Binary files a/src/main/resources/org/sqlite/native/FreeBSD/x86_64/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/FreeBSD/x86_64/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux-Android/aarch64/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux-Android/aarch64/libsqlitejdbc.so index 9e3f093577..3428671113 100755 Binary files a/src/main/resources/org/sqlite/native/Linux-Android/aarch64/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux-Android/aarch64/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux-Android/arm/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux-Android/arm/libsqlitejdbc.so index 9deb07b859..4fd6834941 100755 Binary files a/src/main/resources/org/sqlite/native/Linux-Android/arm/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux-Android/arm/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux-Android/x86/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux-Android/x86/libsqlitejdbc.so index ed461608d8..2d3f37901f 100755 Binary files a/src/main/resources/org/sqlite/native/Linux-Android/x86/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux-Android/x86/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux-Android/x86_64/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux-Android/x86_64/libsqlitejdbc.so index 47a5a69843..04b7e950c0 100755 Binary files a/src/main/resources/org/sqlite/native/Linux-Android/x86_64/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux-Android/x86_64/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux-Musl/aarch64/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux-Musl/aarch64/libsqlitejdbc.so index 603b5e49f8..0437a56c74 100755 Binary files a/src/main/resources/org/sqlite/native/Linux-Musl/aarch64/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux-Musl/aarch64/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux-Musl/x86/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux-Musl/x86/libsqlitejdbc.so index 26f25d1262..4f3dbc3670 100755 Binary files a/src/main/resources/org/sqlite/native/Linux-Musl/x86/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux-Musl/x86/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux-Musl/x86_64/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux-Musl/x86_64/libsqlitejdbc.so index 03773bab74..57032d1f85 100755 Binary files a/src/main/resources/org/sqlite/native/Linux-Musl/x86_64/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux-Musl/x86_64/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux/aarch64/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux/aarch64/libsqlitejdbc.so index 984603f35f..131d95ea1c 100755 Binary files a/src/main/resources/org/sqlite/native/Linux/aarch64/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux/aarch64/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux/arm/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux/arm/libsqlitejdbc.so index 74b07bc129..6e9b4403f0 100755 Binary files a/src/main/resources/org/sqlite/native/Linux/arm/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux/arm/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux/armv6/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux/armv6/libsqlitejdbc.so index b401dd4b9c..0a427e32c8 100755 Binary files a/src/main/resources/org/sqlite/native/Linux/armv6/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux/armv6/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux/armv7/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux/armv7/libsqlitejdbc.so index 3d0b623c40..bda5e9e9c8 100755 Binary files a/src/main/resources/org/sqlite/native/Linux/armv7/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux/armv7/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux/ppc64/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux/ppc64/libsqlitejdbc.so index e1566ba443..d68f3123e0 100755 Binary files a/src/main/resources/org/sqlite/native/Linux/ppc64/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux/ppc64/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux/x86/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux/x86/libsqlitejdbc.so index bc9299fb46..5e87232433 100644 Binary files a/src/main/resources/org/sqlite/native/Linux/x86/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux/x86/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Linux/x86_64/libsqlitejdbc.so b/src/main/resources/org/sqlite/native/Linux/x86_64/libsqlitejdbc.so index dc33ddc1a7..505b62782e 100644 Binary files a/src/main/resources/org/sqlite/native/Linux/x86_64/libsqlitejdbc.so and b/src/main/resources/org/sqlite/native/Linux/x86_64/libsqlitejdbc.so differ diff --git a/src/main/resources/org/sqlite/native/Mac/aarch64/libsqlitejdbc.jnilib b/src/main/resources/org/sqlite/native/Mac/aarch64/libsqlitejdbc.jnilib index b428b579c7..768389aa0b 100755 Binary files a/src/main/resources/org/sqlite/native/Mac/aarch64/libsqlitejdbc.jnilib and b/src/main/resources/org/sqlite/native/Mac/aarch64/libsqlitejdbc.jnilib differ diff --git a/src/main/resources/org/sqlite/native/Mac/x86_64/libsqlitejdbc.jnilib b/src/main/resources/org/sqlite/native/Mac/x86_64/libsqlitejdbc.jnilib index 37df61fc7b..68c34b8736 100755 Binary files a/src/main/resources/org/sqlite/native/Mac/x86_64/libsqlitejdbc.jnilib and b/src/main/resources/org/sqlite/native/Mac/x86_64/libsqlitejdbc.jnilib differ diff --git a/src/main/resources/org/sqlite/native/Windows/aarch64/sqlitejdbc.dll b/src/main/resources/org/sqlite/native/Windows/aarch64/sqlitejdbc.dll index ca4ffbce66..4bc8c08fe6 100755 Binary files a/src/main/resources/org/sqlite/native/Windows/aarch64/sqlitejdbc.dll and b/src/main/resources/org/sqlite/native/Windows/aarch64/sqlitejdbc.dll differ diff --git a/src/main/resources/org/sqlite/native/Windows/armv7/sqlitejdbc.dll b/src/main/resources/org/sqlite/native/Windows/armv7/sqlitejdbc.dll index 0d5da3c8c5..de9a6ace53 100755 Binary files a/src/main/resources/org/sqlite/native/Windows/armv7/sqlitejdbc.dll and b/src/main/resources/org/sqlite/native/Windows/armv7/sqlitejdbc.dll differ diff --git a/src/main/resources/org/sqlite/native/Windows/x86/sqlitejdbc.dll b/src/main/resources/org/sqlite/native/Windows/x86/sqlitejdbc.dll index e058a55e92..0a96eee07b 100755 Binary files a/src/main/resources/org/sqlite/native/Windows/x86/sqlitejdbc.dll and b/src/main/resources/org/sqlite/native/Windows/x86/sqlitejdbc.dll differ diff --git a/src/main/resources/org/sqlite/native/Windows/x86_64/sqlitejdbc.dll b/src/main/resources/org/sqlite/native/Windows/x86_64/sqlitejdbc.dll index 417e26736b..373225320f 100755 Binary files a/src/main/resources/org/sqlite/native/Windows/x86_64/sqlitejdbc.dll and b/src/main/resources/org/sqlite/native/Windows/x86_64/sqlitejdbc.dll differ diff --git a/src/test/java/org/sqlite/MathFunctionsTest.java b/src/test/java/org/sqlite/MathFunctionsTest.java index b89b9e332b..f58faa2ed1 100644 --- a/src/test/java/org/sqlite/MathFunctionsTest.java +++ b/src/test/java/org/sqlite/MathFunctionsTest.java @@ -173,30 +173,68 @@ public void floor() throws Exception { } @Test - // this actually performs ln() - public void log() throws Exception { - Utils.assumeJdbcExtensionsOrMathFunctions(conn); - boolean isLogLn = Utils.getCompileOptions(conn).contains("JDBC_EXTENSIONS"); - + // with the old math extension functions, log would perform ln instead of log10 + public void logAsLn() throws Exception { + Utils.assumeJdbcExtensionsWithoutMathFunctions(conn); ResultSet rs = stat.executeQuery("select log(2)"); assertThat(rs.next()).isTrue(); + assertThat(rs.getDouble(1)).isCloseTo(0.30102999566398114, offset(0.000000000000001)); + rs.close(); + } - double ln = 0.693147180559945; - double log = 0.30102999566398114; + @Test + public void ln() throws Exception { + Utils.assumeMathFunctions(conn); + ResultSet rs = stat.executeQuery("select ln(2)"); + assertThat(rs.next()).isTrue(); + assertThat(rs.getDouble(1)).isCloseTo(0.693147180559945, offset(0.000000000000001)); + rs.close(); + } - assertThat(rs.getDouble(1)).isCloseTo(isLogLn ? ln : log, offset(0.000000000000001)); + @Test + public void logBase() throws Exception { + Utils.assumeMathFunctions(conn); + ResultSet rs = stat.executeQuery("select log(3,3)"); + assertThat(rs.next()).isTrue(); + assertThat(rs.getDouble(1)).isCloseTo(1, offset(0.000000000000001)); rs.close(); } @Test - public void log10() throws Exception { - Utils.assumeJdbcExtensionsOrMathFunctions(conn); - ResultSet rs = stat.executeQuery("select log10(10)"); + public void log2() throws Exception { + Utils.assumeMathFunctions(conn); + ResultSet rs = stat.executeQuery("select log2(2)"); assertThat(rs.next()).isTrue(); assertThat(rs.getDouble(1)).isCloseTo(1, offset(0.000000000000001)); rs.close(); } + @Test + public void log10() throws Exception { + Utils.assumeMathFunctions(conn); + { + ResultSet rs = stat.executeQuery("select log10(10)"); + assertThat(rs.next()).isTrue(); + assertThat(rs.getDouble(1)).isCloseTo(1, offset(0.000000000000001)); + rs.close(); + } + { + ResultSet rs = stat.executeQuery("select log(10)"); + assertThat(rs.next()).isTrue(); + assertThat(rs.getDouble(1)).isCloseTo(1, offset(0.000000000000001)); + rs.close(); + } + } + + @Test + public void mod() throws Exception { + Utils.assumeMathFunctions(conn); + ResultSet rs = stat.executeQuery("select mod(11,3.5)"); + assertThat(rs.next()).isTrue(); + assertThat(rs.getDouble(1)).isEqualTo(0.5); + rs.close(); + } + @Test public void pi() throws Exception { Utils.assumeJdbcExtensionsOrMathFunctions(conn); @@ -212,10 +250,18 @@ public void pi() throws Exception { @Test public void power() throws Exception { Utils.assumeJdbcExtensionsOrMathFunctions(conn); - ResultSet rs = stat.executeQuery("select power(10,2)"); - assertThat(rs.next()).isTrue(); - assertThat(rs.getDouble(1)).isCloseTo(100, offset(0.000000000000001)); - rs.close(); + { + ResultSet rs = stat.executeQuery("select pow(10,2)"); + assertThat(rs.next()).isTrue(); + assertThat(rs.getDouble(1)).isCloseTo(100, offset(0.000000000000001)); + rs.close(); + } + { + ResultSet rs = stat.executeQuery("select power(10,2)"); + assertThat(rs.next()).isTrue(); + assertThat(rs.getDouble(1)).isCloseTo(100, offset(0.000000000000001)); + rs.close(); + } } @Test @@ -280,4 +326,21 @@ public void tanh() throws Exception { assertThat(rs.getDouble(1)).isCloseTo(0.46211715726001, offset(0.000000000000001)); rs.close(); } + + @Test + public void trunc() throws Exception { + Utils.assumeMathFunctions(conn); + { + ResultSet rs = stat.executeQuery("select trunc(1.5)"); + assertThat(rs.next()).isTrue(); + assertThat(rs.getDouble(1)).isCloseTo(1, offset(0.000000000000001)); + rs.close(); + } + { + ResultSet rs = stat.executeQuery("select trunc(-1.5)"); + assertThat(rs.next()).isTrue(); + assertThat(rs.getDouble(1)).isCloseTo(-1, offset(0.000000000000001)); + rs.close(); + } + } } diff --git a/src/test/java/org/sqlite/Utils.java b/src/test/java/org/sqlite/Utils.java index 5f7a2bb6ea..94bc4811a4 100644 --- a/src/test/java/org/sqlite/Utils.java +++ b/src/test/java/org/sqlite/Utils.java @@ -28,6 +28,12 @@ public static void assumeJdbcExtensions(Connection conn) throws SQLException { .contains("JDBC_EXTENSIONS"); } + public static void assumeMathFunctions(Connection conn) throws SQLException { + assumeThat(getCompileOptions(conn)) + .as("SQLite has to be compiled with SQLITE_ENABLE_MATH_FUNCTIONS") + .contains("ENABLE_MATH_FUNCTIONS"); + } + public static void assumeJdbcExtensionsOrMathFunctions(Connection conn) throws SQLException { List compileOptions = getCompileOptions(conn); boolean expected = @@ -38,4 +44,16 @@ public static void assumeJdbcExtensionsOrMathFunctions(Connection conn) throws S "SQLite has to be compiled with JDBC Extensions or SQLITE_ENABLE_MATH_FUNCTIONS") .isTrue(); } + + public static void assumeJdbcExtensionsWithoutMathFunctions(Connection conn) + throws SQLException { + List compileOptions = getCompileOptions(conn); + boolean expected = + compileOptions.contains("JDBC_EXTENSIONS") + && !compileOptions.contains("ENABLE_MATH_FUNCTIONS"); + assumeThat(expected) + .as( + "SQLite has to be compiled with JDBC Extensions and without SQLITE_ENABLE_MATH_FUNCTIONS") + .isTrue(); + } }