@@ -362,10 +362,6 @@ test_price_list_is_duplicate (Fixture *fixture, gconstpointer pData)
362362gboolean
363363gnc_price_list_insert(PriceList **prices, GNCPrice *p, gboolean check_dupl)// Local: 3:0:0
364364*/
365- /* static void
366- test_gnc_price_list_insert (Fixture *fixture, gconstpointer pData)
367- {
368- }*/
369365/* gnc_price_list_remove
370366gboolean
371367gnc_price_list_remove(PriceList **prices, GNCPrice *p)// Local: 1:0:0
@@ -682,6 +678,37 @@ guint
682678gnc_pricedb_get_num_prices(GNCPriceDB *db)// C: 2 in 1 Local: 0:0:0
683679*/
684680
681+ static void
682+ test_gnc_price_list_insert (PriceDBFixture * fixture , gconstpointer pData )
683+ {
684+ GNCPriceDB * db = fixture -> pricedb ;
685+ Commodities * c = fixture -> com ;
686+ QofBook * book = qof_instance_get_book (QOF_INSTANCE (db ));
687+
688+ g_assert_cmpint (gnc_pricedb_get_num_prices (fixture -> pricedb ), = = , 42 );
689+
690+ // nop because 12/4/09 already exists
691+ gnc_pricedb_add_price (db , construct_price (book , c -> usd , c -> aud ,
692+ gnc_dmy2time64 (12 , 4 , 2009 ),
693+ PRICE_SOURCE_USER_PRICE ,
694+ gnc_numeric_create (131190 , 10000 )));
695+ g_assert_cmpint (gnc_pricedb_get_num_prices (fixture -> pricedb ), = = , 42 );
696+
697+ // num_prices increases because because 14/4/09 doesn't exist yet
698+ gnc_pricedb_add_price (db , construct_price (book , c -> usd , c -> aud ,
699+ gnc_dmy2time64 (14 , 4 , 2009 ),
700+ PRICE_SOURCE_USER_PRICE ,
701+ gnc_numeric_create (131190 , 10000 )));
702+ g_assert_cmpint (gnc_pricedb_get_num_prices (fixture -> pricedb ), = = , 43 );
703+
704+ // nop because because 14/4/09 already exists
705+ gnc_pricedb_add_price (db , construct_price (book , c -> usd , c -> aud ,
706+ gnc_dmy2time64 (14 , 4 , 2009 ),
707+ PRICE_SOURCE_USER_PRICE ,
708+ gnc_numeric_create (131190 , 10000 )));
709+ g_assert_cmpint (gnc_pricedb_get_num_prices (fixture -> pricedb ), = = , 43 );
710+ }
711+
685712static void
686713test_gnc_price_list_equal (PriceDBFixture * fixture , gconstpointer pData )
687714{
@@ -1672,7 +1699,7 @@ test_suite_gnc_pricedb (void)
16721699// GNC_TEST_ADD (suitename, "gnc price equal", Fixture, NULL, setup, test_gnc_price_equal, teardown);
16731700// GNC_TEST_ADD (suitename, "compare prices by date", Fixture, NULL, setup, test_compare_prices_by_date, teardown);
16741701// GNC_TEST_ADD (suitename, "price list is duplicate", Fixture, NULL, setup, test_price_list_is_duplicate, teardown);
1675- // GNC_TEST_ADD (suitename, "gnc price list insert", Fixture , NULL, setup, test_gnc_price_list_insert, teardown);
1702+ GNC_TEST_ADD (suitename , "gnc price list insert" , PriceDBFixture , NULL , setup , test_gnc_price_list_insert , teardown );
16761703// GNC_TEST_ADD (suitename, "gnc price list remove", Fixture, NULL, setup, test_gnc_price_list_remove, teardown);
16771704// GNC_TEST_ADD (suitename, "price list destroy helper", Fixture, NULL, setup, test_price_list_destroy_helper, teardown);
16781705// GNC_TEST_ADD (suitename, "gnc price list destroy", Fixture, NULL, setup, test_gnc_price_list_destroy, teardown);
0 commit comments