From dd391d5e8c805efe5f2d735381122b778e2d4a63 Mon Sep 17 00:00:00 2001 From: stelar7 Date: Mon, 11 Dec 2023 15:37:26 +0100 Subject: [PATCH] LibWeb: Add test for week_number_of_the_last_day microsyntax --- Tests/LibWeb/CMakeLists.txt | 1 + Tests/LibWeb/TestMicrosyntax.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Tests/LibWeb/TestMicrosyntax.cpp diff --git a/Tests/LibWeb/CMakeLists.txt b/Tests/LibWeb/CMakeLists.txt index b62aa719c14..440c01dba4c 100644 --- a/Tests/LibWeb/CMakeLists.txt +++ b/Tests/LibWeb/CMakeLists.txt @@ -2,6 +2,7 @@ set(TEST_SOURCES TestCSSIDSpeed.cpp TestCSSPixels.cpp TestHTMLTokenizer.cpp + TestMicrosyntax.cpp TestMimeSniff.cpp TestNumbers.cpp ) diff --git a/Tests/LibWeb/TestMicrosyntax.cpp b/Tests/LibWeb/TestMicrosyntax.cpp new file mode 100644 index 00000000000..0629598d1aa --- /dev/null +++ b/Tests/LibWeb/TestMicrosyntax.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023, stelar7 + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +TEST_CASE(week_number_of_the_last_day) +{ + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(1998), (u32)53); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(1999), (u32)52); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(2000), (u32)52); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(2001), (u32)52); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(2002), (u32)52); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(2003), (u32)52); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(2004), (u32)53); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(2005), (u32)52); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(2006), (u32)52); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(2007), (u32)52); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(2008), (u32)52); + EXPECT_EQ(Web::HTML::week_number_of_the_last_day(2009), (u32)53); +}