Edit

kc3-lang/angle/src/tests/preprocessor_tests/operator_test.cpp

Branch :

  • Show log

    Commit

  • Author : Jamie Madill
    Date : 2018-11-27 11:34:27
    Hash : b980c563
    Message : Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>

  • src/tests/preprocessor_tests/operator_test.cpp
  • //
    // Copyright (c) 2012 The ANGLE Project 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 "PreprocessorTest.h"
    #include "compiler/preprocessor/Token.h"
    
    namespace angle
    {
    
    struct OperatorTestParam
    {
        const char *str;
        int op;
    };
    
    class OperatorTest : public SimplePreprocessorTest,
                         public testing::WithParamInterface<OperatorTestParam>
    {};
    
    TEST_P(OperatorTest, Identified)
    {
        OperatorTestParam param = GetParam();
    
        pp::Token token;
        lexSingleToken(param.str, &token);
        EXPECT_EQ(param.op, token.type);
        EXPECT_EQ(param.str, token.text);
    }
    
    static const OperatorTestParam kOperators[] = {{"(", '('},
                                                   {")", ')'},
                                                   {"[", '['},
                                                   {"]", ']'},
                                                   {".", '.'},
                                                   {"+", '+'},
                                                   {"-", '-'},
                                                   {"~", '~'},
                                                   {"!", '!'},
                                                   {"*", '*'},
                                                   {"/", '/'},
                                                   {"%", '%'},
                                                   {"<", '<'},
                                                   {">", '>'},
                                                   {"&", '&'},
                                                   {"^", '^'},
                                                   {"|", '|'},
                                                   {"?", '?'},
                                                   {":", ':'},
                                                   {"=", '='},
                                                   {",", ','},
                                                   {"++", pp::Token::OP_INC},
                                                   {"--", pp::Token::OP_DEC},
                                                   {"<<", pp::Token::OP_LEFT},
                                                   {">>", pp::Token::OP_RIGHT},
                                                   {"<=", pp::Token::OP_LE},
                                                   {">=", pp::Token::OP_GE},
                                                   {"==", pp::Token::OP_EQ},
                                                   {"!=", pp::Token::OP_NE},
                                                   {"&&", pp::Token::OP_AND},
                                                   {"^^", pp::Token::OP_XOR},
                                                   {"||", pp::Token::OP_OR},
                                                   {"+=", pp::Token::OP_ADD_ASSIGN},
                                                   {"-=", pp::Token::OP_SUB_ASSIGN},
                                                   {"*=", pp::Token::OP_MUL_ASSIGN},
                                                   {"/=", pp::Token::OP_DIV_ASSIGN},
                                                   {"%=", pp::Token::OP_MOD_ASSIGN},
                                                   {"<<=", pp::Token::OP_LEFT_ASSIGN},
                                                   {">>=", pp::Token::OP_RIGHT_ASSIGN},
                                                   {"&=", pp::Token::OP_AND_ASSIGN},
                                                   {"^=", pp::Token::OP_XOR_ASSIGN},
                                                   {"|=", pp::Token::OP_OR_ASSIGN}};
    
    INSTANTIATE_TEST_CASE_P(All, OperatorTest, testing::ValuesIn(kOperators));
    
    }  // namespace angle