Skip to content

Commit

Permalink
[vconone] Notice people to update year
Browse files Browse the repository at this point in the history
But I am not sure this can work.

ONE-DCO-Signed-off-by: Dayoung Lee <[email protected]>
  • Loading branch information
dayo09 committed Jan 23, 2025
1 parent bce28b1 commit 1ba8653
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions compiler/vconone/src/version.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@

#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;
}

}

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

int year = 2024;

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);
}

0 comments on commit 1ba8653

Please sign in to comment.