Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions compiler/vconone/src/version.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@

#include <gtest/gtest.h>

#include <chrono>

namespace
{

int get_current_year(void)
{
auto now = std::chrono::system_clock::now();
std::time_t current_time = std::chrono::system_clock::to_time_t(now);
std::tm *timeinfo = std::localtime(&current_time);

int year = timeinfo->tm_year + 1900;
return year;
}

} // namespace

TEST(vconone, version_number)
{
auto v = vconone::get_number();
Expand Down Expand Up @@ -45,5 +62,15 @@ TEST(vconone, copyright)
{
auto str = vconone::get_copyright();

int year = 2024;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Get this year properly from get_copyright function


if (year < get_current_year())
{
std::cout << "!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!\r\n";
std::cout << "\tPlease update vconone year.\r\n";
std::cout << "\tIt seems it's a new year and vconcone is not updated.\r\n";
std::cout << "\tHappy new year!\r\n";
}

ASSERT_NE("", str);
}