Ticket #13685: 0001-BDurationFormatTest-Add-test-cases-for-abbreviated-f.patch

File 0001-BDurationFormatTest-Add-test-cases-for-abbreviated-f.patch, 1.3 KB (added by akshay, 7 years ago)
  • src/tests/kits/locale/DurationFormatTest.cpp

    From f7d5423439406db898dad914e6dd3d9fec4bc5e2 Mon Sep 17 00:00:00 2001
    From: Akshay Agarwal <agarwal.akshay.akshay8@gmail.com>
    Date: Sat, 26 Aug 2017 16:46:14 +0530
    Subject: [PATCH] BDurationFormatTest: Add test cases for abbreviated format
     style.
    
    ---
     src/tests/kits/locale/DurationFormatTest.cpp | 20 ++++++++++++++++++++
     1 file changed, 20 insertions(+)
    
    diff --git a/src/tests/kits/locale/DurationFormatTest.cpp b/src/tests/kits/locale/DurationFormatTest.cpp
    index ceb5167..cd17576 100644
    a b DurationFormatTest::TestDuration()  
    7070        CPPUNIT_ASSERT_EQUAL(B_OK, result);
    7171        CPPUNIT_ASSERT_EQUAL(expected, buffer);
    7272    }
     73
     74    {
     75        BDurationFormat format(englishLanguage, englishFormat,
     76            ":", B_TIME_UNIT_ABBREVIATED);
     77        status_t result = format.Format(buffer, 0, 800000000000ll);
     78
     79        expected << "1 wk:2 days:6 hr:13 min:20 sec";
     80        CPPUNIT_ASSERT_EQUAL(B_OK, result);
     81        CPPUNIT_ASSERT_EQUAL(expected, buffer);
     82    }
     83
     84    {
     85        BDurationFormat format(frenchLanguage, frenchFormat,
     86            ":", B_TIME_UNIT_ABBREVIATED);
     87        result = format.Format(buffer, 0, 800000000000ll);
     88
     89        expected << "1 sem.:2 j:6 h:13 min:20 s";
     90        CPPUNIT_ASSERT_EQUAL(B_OK, result);
     91        CPPUNIT_ASSERT_EQUAL(expected, buffer);
     92    }
    7393}
    7494
    7595