+++ /dev/null
-/* Copyright (C) 2003 TSUTSUMI Kikuo.
- This file is part of the CCUnit Library.
-
- The CCUnit Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- as published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- The CCUnit Library is distributed in the hope that it will be
- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the CCUnit Library; see the file COPYING.LESSER.
- If not, write to the Free Software Foundation, Inc., 59 Temple
- Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-/*
- * $Id$
- */
-
-#include <ccunit/CCUnitTestSuite.h>
-
-void setUp_complex_test ();
-void tearDown_complex_test ();
-void test_complex_equals ();
-void test_complex_add ();
-void test_complex_sub ();
-
-void setUp_complex_mul_div ();
-void tearDown_complex_mul_div ();
-void test_complex_mul ();
-void test_complex_div ();
-
-CCUnitTestSuite* complex_add_sub_suite ()
-{
- CCUnitTestFixture* fixture;
- CCUnitTestSuite* suite;
- fixture = ccunit_newTestFixture ("complex add sub test",
- CCUNIT_NEWTESTFUNC(setUp_complex_test),
- CCUNIT_NEWTESTFUNC(tearDown_complex_test));
- ccunit_addNewTestCase (fixture,
- "test_complex_equals",
- "complex equals test",
- test_complex_equals);
- ccunit_addNewTestCase (fixture,
- "test_complex_add",
- "complex add test",
- test_complex_add);
- ccunit_addNewTestCase (fixture,
- "test_complex_sub",
- "complex sub test",
- test_complex_sub);
- suite = ccunit_newTestSuite ("complex add/sub test");
- ccunit_addTestFixture (suite, fixture);
- return suite;
-}
-
-CCUnitTestSuite* complex_mul_div_suite ()
-{
- CCUnitTestFixture* fixture;
- CCUnitTestSuite* suite;
- fixture = ccunit_newTestFixture ("complex mul div test",
- CCUNIT_NEWTESTFUNC(setUp_complex_mul_div),
- CCUNIT_NEWTESTFUNC(tearDown_complex_mul_div));
- ccunit_addNewTestCase (fixture,
- "test_complex_mul",
- "complex mul test",
- test_complex_mul);
- ccunit_addNewTestCase (fixture,
- "test_complex_div",
- "complex div test",
- test_complex_div);
- suite = ccunit_newTestSuite ("complex mul/div test");
- ccunit_addTestFixture (suite, fixture);
- return suite;
-}
+++ /dev/null
-/* Copyright (C) 2003 TSUTSUMI Kikuo.
- This file is part of the CCUnit Library.
-
- The CCUnit Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- as published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- The CCUnit Library is distributed in the hope that it will be
- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the CCUnit Library; see the file COPYING.LESSER.
- If not, write to the Free Software Foundation, Inc., 59 Temple
- Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-/*
- * $Id$
- */
-
-#include <stdio.h>
-#include <ccunit/CCUnitTestRunner.h>
-#include <ccunit/CCUnitTestSuite.h>
-
-extern CCUnitTestSuite* complex_suite (const char* name);
-
-int main ()
-{
- CCUnitTestRunner* runner;
- CCUnitTestSuite* suite;
- runner = ccunit_newTestRunner (stdout);
- suite = complex_suite ("complex test suite");
- return ccunit_runTestRunner (runner, suite);
-}
+++ /dev/null
-/* Copyright (C) 2003 TSUTSUMI Kikuo.
- This file is part of the CCUnit Library.
-
- The CCUnit Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- as published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- The CCUnit Library is distributed in the hope that it will be
- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the CCUnit Library; see the file COPYING.LESSER.
- If not, write to the Free Software Foundation, Inc., 59 Temple
- Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-/*
- * $Id$
- */
-
-#include <ccunit/CCUnit.h>
-
-extern void setUp_complex_test();
-extern void tearDown_complex_test();
-extern void test_complex_equals();
-extern void test_complex_add();
-
-int main ()
-{
- CCUnitTestFixture* fixture;
- CCUnitTestResult* result;
- bool success;
- fixture = ccunit_newTestFixture ("complex test",
- CCUNIT_NEWTESTFUNC(setUp_complex_test),
- CCUNIT_NEWTESTFUNC(tearDown_complex_test));
- ccunit_addNewTestCase (fixture,
- "test_complex_equals",
- "complex equals test",
- test_complex_equals);
- ccunit_addNewTestCase (fixture,
- "test_complex_add",
- "complex add test",
- test_complex_add);
- result = ccunit_runTestFixture (fixture);
- success = ccunit_wasSuccessful (result);
- return success ? 0 : -1;
-}
+++ /dev/null
-/* Copyright (C) 2003 TSUTSUMI Kikuo.
- This file is part of the CCUnit Library.
-
- The CCUnit Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- as published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- The CCUnit Library is distributed in the hope that it will be
- useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the CCUnit Library; see the file COPYING.LESSER.
- If not, write to the Free Software Foundation, Inc., 59 Temple
- Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-/*
- * $Id$
- */
-
-#include <ccunit/CCUnitAssert.h>
-
-/** TEST SUITE: complex mul div test suite */
-
-/** TEST CASE: complex number mul/div test */
-
-#include <complex.h>
-
-static complex_t* s6_3;
-static complex_t* s3_2;
-static complex_t* smul;
-static complex_t* sdiv;
-
-void setUp_complex_mul_div ()
-{
- const double r2 = 3*3 + 2*2;
- s6_3 = complex_new (6, 3);
- s3_2 = complex_new (3, 2);
- smul = complex_new (6*3 - 3*2, 6*2 + 3*3);
- sdiv = complex_new ((6*3 + 3*2)/r2, (3*3 - 6*2)/r2);
-}
-
-void tearDown_complex_mul_div ()
-{
- complex_delete (s6_3);
- complex_delete (s3_2);
- complex_delete (smul);
- complex_delete (sdiv);
-}
-
-void test_complex_mul ()
-{
- complex_t result;
- CCUNIT_ASSERT_TEST_OBJ (smul, complex_equals,
- complex_mul (&result, s6_3, s3_2),
- complex_to_string);
-}
-
-void test_complex_div ()
-{
- complex_t result;
- CCUNIT_ASSERT_TEST_OBJ (sdiv, complex_equals,
- complex_div (&result, s6_3, s3_2),
- complex_to_string);
-}