diff options
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | Makefile.in | 21 | ||||
-rw-r--r-- | tests/corelib/numerics/Commodity.cc | 40 | ||||
-rw-r--r-- | tests/corelib/numerics/Commodity.h | 36 | ||||
-rw-r--r-- | tests/corelib/numerics/CommodityAmount.cc | 20 | ||||
-rw-r--r-- | tests/corelib/numerics/CommodityAmount.h | 8 |
6 files changed, 97 insertions, 31 deletions
diff --git a/Makefile.am b/Makefile.am index af1686f1..4d5aa886 100644 --- a/Makefile.am +++ b/Makefile.am @@ -197,7 +197,8 @@ check_PROGRAMS = $(TESTS) UnitTests_SOURCES = tests/UnitTests.cc \ \ tests/corelib/numerics/BasicAmount.cc \ - tests/corelib/numerics/CommodityAmount.cc + tests/corelib/numerics/CommodityAmount.cc \ + tests/corelib/numerics/Commodity.cc UnitTests_LDADD = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la -lcppunit UnitTests_LDFLAGS = $(LIBADD_DL) diff --git a/Makefile.in b/Makefile.in index 4d72dd03..bf8e69c8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -134,7 +134,8 @@ PyUnitTests_OBJECTS = $(am_PyUnitTests_OBJECTS) PyUnitTests_LDADD = $(LDADD) am_UnitTests_OBJECTS = UnitTests-UnitTests.$(OBJEXT) \ UnitTests-BasicAmount.$(OBJEXT) \ - UnitTests-CommodityAmount.$(OBJEXT) + UnitTests-CommodityAmount.$(OBJEXT) \ + UnitTests-Commodity.$(OBJEXT) UnitTests_OBJECTS = $(am_UnitTests_OBJECTS) UnitTests_DEPENDENCIES = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la UnitTests_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ @@ -406,7 +407,8 @@ info_TEXINFOS = ledger.texi UnitTests_SOURCES = tests/UnitTests.cc \ \ tests/corelib/numerics/BasicAmount.cc \ - tests/corelib/numerics/CommodityAmount.cc + tests/corelib/numerics/CommodityAmount.cc \ + tests/corelib/numerics/Commodity.cc UnitTests_LDADD = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la -lcppunit UnitTests_LDFLAGS = $(LIBADD_DL) @@ -558,6 +560,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-BasicAmount.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-Commodity.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-CommodityAmount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-UnitTests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ledger-main.Po@am__quote@ @@ -859,6 +862,20 @@ UnitTests-CommodityAmount.obj: tests/corelib/numerics/CommodityAmount.cc @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -c -o UnitTests-CommodityAmount.obj `if test -f 'tests/corelib/numerics/CommodityAmount.cc'; then $(CYGPATH_W) 'tests/corelib/numerics/CommodityAmount.cc'; else $(CYGPATH_W) '$(srcdir)/tests/corelib/numerics/CommodityAmount.cc'; fi` +UnitTests-Commodity.o: tests/corelib/numerics/Commodity.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -MT UnitTests-Commodity.o -MD -MP -MF $(DEPDIR)/UnitTests-Commodity.Tpo -c -o UnitTests-Commodity.o `test -f 'tests/corelib/numerics/Commodity.cc' || echo '$(srcdir)/'`tests/corelib/numerics/Commodity.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/UnitTests-Commodity.Tpo $(DEPDIR)/UnitTests-Commodity.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tests/corelib/numerics/Commodity.cc' object='UnitTests-Commodity.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -c -o UnitTests-Commodity.o `test -f 'tests/corelib/numerics/Commodity.cc' || echo '$(srcdir)/'`tests/corelib/numerics/Commodity.cc + +UnitTests-Commodity.obj: tests/corelib/numerics/Commodity.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -MT UnitTests-Commodity.obj -MD -MP -MF $(DEPDIR)/UnitTests-Commodity.Tpo -c -o UnitTests-Commodity.obj `if test -f 'tests/corelib/numerics/Commodity.cc'; then $(CYGPATH_W) 'tests/corelib/numerics/Commodity.cc'; else $(CYGPATH_W) '$(srcdir)/tests/corelib/numerics/Commodity.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/UnitTests-Commodity.Tpo $(DEPDIR)/UnitTests-Commodity.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tests/corelib/numerics/Commodity.cc' object='UnitTests-Commodity.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -c -o UnitTests-Commodity.obj `if test -f 'tests/corelib/numerics/Commodity.cc'; then $(CYGPATH_W) 'tests/corelib/numerics/Commodity.cc'; else $(CYGPATH_W) '$(srcdir)/tests/corelib/numerics/Commodity.cc'; fi` + ledger-option.o: option.cc @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ledger_CXXFLAGS) $(CXXFLAGS) -MT ledger-option.o -MD -MP -MF $(DEPDIR)/ledger-option.Tpo -c -o ledger-option.o `test -f 'option.cc' || echo '$(srcdir)/'`option.cc @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/ledger-option.Tpo $(DEPDIR)/ledger-option.Po diff --git a/tests/corelib/numerics/Commodity.cc b/tests/corelib/numerics/Commodity.cc new file mode 100644 index 00000000..77cdd7b9 --- /dev/null +++ b/tests/corelib/numerics/Commodity.cc @@ -0,0 +1,40 @@ +#include "Commodity.h" +#include "ledger.h" + +using namespace ledger; + +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CommodityTestCase, "numerics"); + +void CommodityTestCase::setUp() {} +void CommodityTestCase::tearDown() {} + +void CommodityTestCase::testConstructors() +{ + +} + +void CommodityTestCase::testPriceHistory() +{ + // jww (2007-04-17): tbd + amount_t x1("100.10 AAPL"); + + assertEqual(x1, x1.value(datetime_t())); + + assertValid(x1); +} + +void CommodityTestCase::testLots() +{ + // jww (2007-04-17): tbd +} + +void CommodityTestCase::testScalingBase() +{ + // jww (2007-04-17): tbd +} + +void CommodityTestCase::testReduction() +{ + // jww (2007-04-17): tbd +} + diff --git a/tests/corelib/numerics/Commodity.h b/tests/corelib/numerics/Commodity.h new file mode 100644 index 00000000..46af6ecf --- /dev/null +++ b/tests/corelib/numerics/Commodity.h @@ -0,0 +1,36 @@ +#ifndef _COMMMODITY_H +#define _COMMMODITY_H + +#include "UnitTests.h" + +class CommodityTestCase : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(CommodityTestCase); + + CPPUNIT_TEST(testConstructors); + CPPUNIT_TEST(testPriceHistory); + CPPUNIT_TEST(testLots); + CPPUNIT_TEST(testScalingBase); + CPPUNIT_TEST(testReduction); + + CPPUNIT_TEST_SUITE_END(); + +public: + CommodityTestCase() {} + virtual ~CommodityTestCase() {} + + virtual void setUp(); + virtual void tearDown(); + + void testConstructors(); + void testPriceHistory(); + void testLots(); + void testScalingBase(); + void testReduction(); + +private: + CommodityTestCase(const CommodityTestCase ©); + void operator=(const CommodityTestCase ©); +}; + +#endif /* _COMMMODITY_H */ diff --git a/tests/corelib/numerics/CommodityAmount.cc b/tests/corelib/numerics/CommodityAmount.cc index 0eca3140..c41b33d4 100644 --- a/tests/corelib/numerics/CommodityAmount.cc +++ b/tests/corelib/numerics/CommodityAmount.cc @@ -665,26 +665,6 @@ void CommodityAmountTestCase::testAbs() assertValid(x2); } -void CommodityAmountTestCase::testPriceHistory() -{ - // jww (2007-04-17): tbd -} - -void CommodityAmountTestCase::testLots() -{ - // jww (2007-04-17): tbd -} - -void CommodityAmountTestCase::testScalingBase() -{ - // jww (2007-04-17): tbd -} - -void CommodityAmountTestCase::testReduction() -{ - // jww (2007-04-17): tbd -} - void CommodityAmountTestCase::testPrinting() { amount_t x0; diff --git a/tests/corelib/numerics/CommodityAmount.h b/tests/corelib/numerics/CommodityAmount.h index 70d55de4..5ffa7810 100644 --- a/tests/corelib/numerics/CommodityAmount.h +++ b/tests/corelib/numerics/CommodityAmount.h @@ -24,10 +24,6 @@ class CommodityAmountTestCase : public CPPUNIT_NS::TestCase CPPUNIT_TEST(testSign); CPPUNIT_TEST(testAbs); CPPUNIT_TEST(testPrinting); - CPPUNIT_TEST(testPriceHistory); - CPPUNIT_TEST(testLots); - CPPUNIT_TEST(testScalingBase); - CPPUNIT_TEST(testReduction); CPPUNIT_TEST_SUITE_END(); @@ -55,10 +51,6 @@ public: void testSign(); void testAbs(); void testPrinting(); - void testPriceHistory(); - void testLots(); - void testScalingBase(); - void testReduction(); private: CommodityAmountTestCase(const CommodityAmountTestCase ©); |