[gimp] tests: fix clang compilation error on test-eevl.c
- From: Alex Samorukov <asamorukov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] tests: fix clang compilation error on test-eevl.c
- Date: Fri, 23 Nov 2018 21:33:51 +0000 (UTC)
commit 4e3441137e3f9d7a11668c481eeb3b0f9e30cf0e
Author: Oleksii Samorukov <samm os2 kiev ua>
Date: Fri Nov 23 22:32:32 2018 +0100
tests: fix clang compilation error on test-eevl.c
(cherry picked from commit 40a08dcf48981d84a6d44807bc721dc121bec99b)
libgimpwidgets/test-eevl.c | 71 +++++++++++++++++++++++-----------------------
1 file changed, 35 insertions(+), 36 deletions(-)
---
diff --git a/libgimpwidgets/test-eevl.c b/libgimpwidgets/test-eevl.c
index 1d0a5e3b6b..fb3a40ce0e 100644
--- a/libgimpwidgets/test-eevl.c
+++ b/libgimpwidgets/test-eevl.c
@@ -40,42 +40,6 @@ typedef struct
gboolean should_succeed;
} TestCase;
-static TestCase cases[] =
-{
- /* "Default" test case */
- { "2in + 3in", { 2 + 3, 1}, TRUE },
-
- /* Whitespace variations */
- { "2in+3in", { 2 + 3, 1}, TRUE },
- { " 2in + 3in", { 2 + 3, 1}, TRUE },
- { "2in + 3in ", { 2 + 3, 1}, TRUE },
- { "2 in + 3 in", { 2 + 3, 1}, TRUE },
- { " 2 in + 3 in ", { 2 + 3, 1}, TRUE },
-
- /* Make sure the default unit is applied as it should */
- { "2 + 3in", { 2 + 3, 1 }, TRUE },
- { "3", { 3, 1 }, TRUE },
-
- /* Somewhat complicated input */
- { "(2 + 3)in", { 2 + 3, 1}, TRUE },
-// { "2 / 3 in", { 2 / 3., 1}, TRUE },
- { "(2 + 2/3)in", { 2 + 2 / 3., 1}, TRUE },
- { "1/2 + 1/2", { 1, 1}, TRUE },
- { "2 ^ 3 ^ 4", { pow (2, pow (3, 4)), 1}, TRUE },
-
- /* Mixing of units */
- { "2mm + 3in", { 2 / 25.4 + 3, 1}, TRUE },
-
- /* 'odd' behavior */
- { "2 ++ 1", { 3, 1}, TRUE },
- { "2 +- 1", { 1, 1}, TRUE },
- { "2 -- 1", { 3, 1}, TRUE },
-
- /* End of test cases */
- { NULL, { 0, 0 }, TRUE }
-};
-
-
static gboolean
test_units (const gchar *ident,
GimpEevlQuantity *result,
@@ -111,6 +75,41 @@ main(void)
gint failed = 0;
gint succeeded = 0;
+ TestCase cases[] =
+ {
+ /* "Default" test case */
+ { "2in + 3in", { 2 + 3, 1}, TRUE },
+
+ /* Whitespace variations */
+ { "2in+3in", { 2 + 3, 1}, TRUE },
+ { " 2in + 3in", { 2 + 3, 1}, TRUE },
+ { "2in + 3in ", { 2 + 3, 1}, TRUE },
+ { "2 in + 3 in", { 2 + 3, 1}, TRUE },
+ { " 2 in + 3 in ", { 2 + 3, 1}, TRUE },
+
+ /* Make sure the default unit is applied as it should */
+ { "2 + 3in", { 2 + 3, 1 }, TRUE },
+ { "3", { 3, 1 }, TRUE },
+
+ /* Somewhat complicated input */
+ { "(2 + 3)in", { 2 + 3, 1}, TRUE },
+ // { "2 / 3 in", { 2 / 3., 1}, TRUE },
+ { "(2 + 2/3)in", { 2 + 2 / 3., 1}, TRUE },
+ { "1/2 + 1/2", { 1, 1}, TRUE },
+ { "2 ^ 3 ^ 4", { pow (2, pow (3, 4)), 1}, TRUE },
+
+ /* Mixing of units */
+ { "2mm + 3in", { 2 / 25.4 + 3, 1}, TRUE },
+
+ /* 'odd' behavior */
+ { "2 ++ 1", { 3, 1}, TRUE },
+ { "2 +- 1", { 1, 1}, TRUE },
+ { "2 -- 1", { 3, 1}, TRUE },
+
+ /* End of test cases */
+ { NULL, { 0, 0 }, TRUE }
+ };
+
g_print ("Testing Eevl Eva, the Evaluator\n\n");
for (i = 0; cases[i].string; i++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]