gnucash stable: [test gnc-quotes] Allow quote time and now time to differ slightly.

John Ralls jralls at code.gnucash.org
Tue May 27 19:30:46 EDT 2025


Updated	 via  https://github.com/Gnucash/gnucash/commit/71939be5 (commit)
	from  https://github.com/Gnucash/gnucash/commit/68cecd81 (commit)



commit 71939be5fa2bf22fb7a118c79f9145232e79ae7a
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue May 27 16:29:16 2025 -0700

    [test gnc-quotes] Allow quote time and now time to differ slightly.
    
    Prevents the occasional spurious test failure.

diff --git a/libgnucash/app-utils/test/gtest-gnc-quotes.cpp b/libgnucash/app-utils/test/gtest-gnc-quotes.cpp
index 08b79c96b8..d6f1ff1831 100644
--- a/libgnucash/app-utils/test/gtest-gnc-quotes.cpp
+++ b/libgnucash/app-utils/test/gtest-gnc-quotes.cpp
@@ -378,7 +378,7 @@ TEST_F(GncQuotesTest, no_date)
     auto datetime{static_cast<time64>(GncDateTime())};
 
     EXPECT_EQ(usd, gnc_price_get_currency(price));
-    EXPECT_EQ(datetime, gnc_price_get_time64(price));
+    EXPECT_TRUE (abs(datetime - gnc_price_get_time64(price)) <= 1);
     EXPECT_EQ(PRICE_SOURCE_FQ, gnc_price_get_source(price));
     EXPECT_TRUE(gnc_numeric_equal(GncNumeric{1337, 100},
                                   gnc_price_get_value(price)));



Summary of changes:
 libgnucash/app-utils/test/gtest-gnc-quotes.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



More information about the gnucash-changes mailing list