blob: 849905aae260cb503e8714079cbef280e5e2cf0a [file] [log] [blame]
Alex Deymob3fa53b2016-04-18 19:57:58 -07001//
2// Copyright (C) 2016 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17#include "update_engine/omaha_utils.h"
18
19#include <gtest/gtest.h>
20#include <vector>
21
22namespace chromeos_update_engine {
23
24class OmahaUtilsTest : public ::testing::Test {};
25
Jae Hoon Kim051627a2019-09-03 12:56:32 -070026TEST(OmahaUtilsTest, EolDateTest) {
27 // Supported values are converted back and forth properly.
28 const std::vector<EolDate> tests = {kEolDateInvalid, -1, 0, 1};
29 for (EolDate eol_date : tests) {
30 EXPECT_EQ(eol_date, StringToEolDate(EolDateToString(eol_date)))
31 << "The StringToEolDate() was " << EolDateToString(eol_date);
32 }
33
34 // Invalid values are assumed as "supported".
35 EXPECT_EQ(kEolDateInvalid, StringToEolDate(""));
36 EXPECT_EQ(kEolDateInvalid, StringToEolDate("hello, world!"));
37}
38
Alex Deymob3fa53b2016-04-18 19:57:58 -070039} // namespace chromeos_update_engine