[aravis] evaluator: more unit tests.



commit c9b125ff26bb87ae1815b99a791cc0f1f850e8e6
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Tue Jun 15 23:02:28 2010 +0200

    evaluator: more unit tests.

 src/tests/evaluator.c |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/src/tests/evaluator.c b/src/tests/evaluator.c
index f901ddb..6b9e13d 100644
--- a/src/tests/evaluator.c
+++ b/src/tests/evaluator.c
@@ -18,7 +18,39 @@ static const ExpressionTestData expression_test_data[] = {
 	{"/evaluator/greater-true",	"2>1",			1,	1.0},
 	{"/evaluator/greater-false",	"2>2",			0,	0.0},
 	{"/evaluator/lower-true",	"1<2",			1,	1.0},
-	{"/evaluator/lower-false",	"2<2",			0,	0.0}
+	{"/evaluator/lower-false",	"2<2",			0,	0.0},
+	{"/evaluator/substraction",	"10-8",			2,	2.0},
+	{"/evaluator/multiplication",	"2.5*4",	       	10,	10.0},
+	{"/evaluator/division",		"10/4",			2,	2.0},
+	{"/evaluator/division-float",	"10.0/4",		2,	2.5},
+	{"/evaluator/minus",		"4*-3",			-12,	-12.0},
+	{"/evaluator/remainder",	"10%3",			1,	1.0},
+	{"/evaluator/power",		"2**10",		1024,	1024.0},
+	{"/evaluator/power-precedence",	"2**10*2",		2048,	2048.0},
+	{"/evaluator/and",		"255 & 8",		8,	8.0},
+	{"/evaluator/or",		"128 | 8",		136,	136.0},
+	{"/evaluator/xor",		"3 ^ 1",		2,	2.0},
+	{"/evaluator/not",		"~255",			-256,   -256.0},
+	{"/evaluator/not-equal-true",	"1<>2",			1,	1.0},
+	{"/evaluator/not-equal-false",	"1<>1",			0,	0.0},
+	{"/evaluator/equal-true",	"1=1",			1,	1.0},
+	{"/evaluator/equal-flase",	"1=2",			0,	0.0},
+	{"/evaluator/greater-true",	"2>1",			1,	1.0},
+	{"/evaluator/greater-false",	"1>1",			0,	0.0},
+	{"/evaluator/less-true",	"1<2",			1,	1.0},
+	{"/evaluator/less-false",	"1<1",			0,	0.0},
+	{"/evaluator/greater-or-equal-true",	"2>=2",		1,	1.0},
+	{"/evaluator/greater-or-equal-false",	"1>=2",		0,	0.0},
+	{"/evaluator/less-or-equal-true",	"2<=2",		1,	1.0},
+	{"/evaluator/less-or-equal-false",	"2<=1",		0,	0.0},
+	{"/evaluator/logical-and-true",	"(2=2)&(1=1)",		1,	1.0},
+	{"/evaluator/logical-and-false","(2=2)&(1=2)",		0,	0.0},
+	{"/evaluator/logical-or-true",	"(2=2)|(1=2)",		1,	1.0},
+	{"/evaluator/logical-or-false",	"(1=2)|(0=2)",		0,	0.0},
+	{"/evaluator/left-shift",	"1<<4",			16,	16.0},
+	{"/evaluator/right-shift",	"16>>4",		1,	1.0},
+	{"/evaluator/cos",		"COS(PI)",		-1,	-1.0},
+	{"/evaluator/sin",		"SIN(-PI/2)",		-1,	-1.0}
 };
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]