aboutsummaryrefslogtreecommitdiffstats
path: root/brillo/timezone/tzif_parser_test.cc
blob: 305da4d3415c8484987e11e6dfc117a2d58ecb19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2018 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <stdlib.h>

#include <base/files/file_path.h>
#include <gtest/gtest.h>

#include "brillo/timezone/tzif_parser.h"

namespace brillo {

namespace timezone {

class TzifParserTest : public ::testing::Test {
 public:
  TzifParserTest() {
    source_dir_ =
        base::FilePath(getenv("SRC")).Append("brillo").Append("timezone");
  }

 protected:
  base::FilePath source_dir_;
};

TEST_F(TzifParserTest, EST) {
  auto posix_result = GetPosixTimezone(source_dir_.Append("EST_test.tzif"));
  EXPECT_EQ(posix_result, "EST5");
}

TEST_F(TzifParserTest, TzifVersionTwo) {
  auto posix_result =
      GetPosixTimezone(source_dir_.Append("Indian_Christmas_test.tzif"));
  EXPECT_EQ(posix_result, "<+07>-7");
}

TEST_F(TzifParserTest, TzifVersionThree) {
  auto posix_result =
      GetPosixTimezone(source_dir_.Append("Pacific_Fiji_test.tzif"));
  EXPECT_EQ(posix_result, "<+12>-12<+13>,M11.1.0,M1.2.2/123");
}

}  // namespace timezone

}  // namespace brillo