gcalctool r2269 - trunk/gcalctool
- From: kniederk svn gnome org
- To: svn-commits-list gnome org
- Subject: gcalctool r2269 - trunk/gcalctool
- Date: Thu, 16 Oct 2008 23:08:25 +0000 (UTC)
Author: kniederk
Date: Thu Oct 16 23:08:24 2008
New Revision: 2269
URL: http://svn.gnome.org/viewvc/gcalctool?rev=2269&view=rev
Log:
Added a few unittests. Committing to test my new account.
Modified:
trunk/gcalctool/unittest.c
Modified: trunk/gcalctool/unittest.c
==============================================================================
--- trunk/gcalctool/unittest.c (original)
+++ trunk/gcalctool/unittest.c Thu Oct 16 23:08:24 2008
@@ -60,12 +60,15 @@
test("0", "0", 0);
test("1", "1", 0);
test("+1", "1", 0);
- test("++1", "1", 0);
- test("--1", "1", 0);
+ test("++1", "1", 0);
+ test("--1", "1", 0);
test("255", "255", 0);
test("256", "256", 0);
test("1.00", "1", 0);
- test("1.01", "1.01", 0);
+ test("1.01", "1.01", 0);
+ test("pi", "3.1415926", 0);
+ test("1e+3", "1000", 0);
+ test("1e-3", "0.001", 0);
test("1e9", "1000000000", 0);
test("0+0", "0", 0);
@@ -92,7 +95,7 @@
test("1/4", "0.25", 0);
test("(-3)/(-6)", "0.5", 0);
- test("1+2*3", "7", 0);
+ test("1+2*3", "7", 0);
test("(1+2)*3", "9", 0);
test("100%", "1", 0);
@@ -100,8 +103,8 @@
test("2^2", "4", 0);
test("2^-1", "0.5", 0);
test("-10^2", "-100", 0);
- test("(-10)^2", "100", 0);
- test("0!", "1", 0);
+ test("(-10)^2", "100", 0);
+ test("0!", "1", 0);
test("1!", "1", 0);
test("5!", "120", 0);
//FIXME: Need to update do_factorial() test("0.1!", "", 0);
@@ -113,15 +116,33 @@
test("Int(3.2)", "3", 0);
test("Frac(3.2)", "0.2", 0);
test("Int(-3.2)", "-3", 0);
- test("Frac(-3.2)", "-0.2", 0);
+ test("Frac(-3.2)", "-0.2", 0);
test("Abs(1)", "1", 0);
- test("Abs(-1)", "1", 0);
+ test("Abs(-1)", "1", 0);
test("Sin(0)", "0", 0);
test("Cos(0)", "1", 0);
test("Tan(0)", "0", 0);
-
+
+ test("Acos(0)", "90", 0);
+ test("Acos(1)", "0", 0);
+ test("Acos(-1)", "180", 0);
+ test("Acos(1/Sqrt(2))", "45", 0);
+
+ test("Asin(0)", "0", 0);
+ test("Asin(1)", "90", 0);
+ test("Asin(-1)", "-90", 0);
+ test("Asin(1/Sqrt(2))", "45", 0);
+
+ test("Cosh(0)", "1", 0);
+ test("Cosh(10) - (e^(10)+e^(-10))/2", "0", 0);
+
+ test("Sinh(0)", "0", 0);
+ test("Sinh(10) - (e^(10)-e^(-10))/2", "0", 0);
+
+ test("Cosh(-5)^2 - Sinh(-5)^2", "1", 0);
+
v->ttype = DEG;
test("Sin(90)", "1", 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]