xref: /aosp_15_r20/external/pdfium/xfa/fxfa/parser/xfa_utils_unittest.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2014 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "xfa/fxfa/parser/xfa_utils.h"
6 
7 #include <iterator>
8 
9 #include "testing/gtest/include/gtest/gtest.h"
10 
TEST(XfaUtilsImpTest,XFA_MapRotation)11 TEST(XfaUtilsImpTest, XFA_MapRotation) {
12   struct TestCase {
13     int input;
14     int expected_output;
15   } TestCases[] = {{-1000000, 80}, {-361, 359}, {-360, 0},  {-359, 1},
16                    {-91, 269},     {-90, 270},  {-89, 271}, {-1, 359},
17                    {0, 0},         {1, 1},      {89, 89},   {90, 90},
18                    {91, 91},       {359, 359},  {360, 0},   {361, 1},
19                    {100000, 280}};
20 
21   for (size_t i = 0; i < std::size(TestCases); ++i) {
22     EXPECT_EQ(TestCases[i].expected_output,
23               XFA_MapRotation(TestCases[i].input));
24   }
25 }
26