chromium/third_party/dawn/src/tint/lang/wgsl/reader/parser/lexer_test.cc

// Copyright 2020 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "src/tint/lang/wgsl/reader/parser/lexer.h"

#include <limits>
#include <string>
#include <tuple>
#include <vector>

#include "gtest/gtest.h"
#include "src/tint/lang/core/fluent_types.h"
#include "src/tint/lang/core/number.h"

usingnamespacetint::core::fluent_types;  // NOLINT

namespace tint::wgsl::reader {
namespace {

LexerTest;

// Blankspace constants. These are macros on purpose to be able to easily build
// up string literals with them.
//
// Same line code points
#define kSpace
#define kHTab
#define kL2R
#define kR2L
// Line break code points
#define kCR
#define kLF
#define kVTab
#define kFF
#define kNL
#define kLS
#define kPS

TEST_F(LexerTest, Empty) {}

TEST_F(LexerTest, Skips_Blankspace_Basic) {}

TEST_F(LexerTest, Skips_Blankspace_Exotic) {}

TEST_F(LexerTest, Skips_Comments_Line) {}

TEST_F(LexerTest, Skips_Comments_Unicode) {}

LineCommentTerminatorTest;
TEST_P(LineCommentTerminatorTest, Terminators) {}
INSTANTIATE_TEST_SUITE_P();

TEST_F(LexerTest, Skips_Comments_Block) {}

TEST_F(LexerTest, Skips_Comments_Block_Nested) {}

TEST_F(LexerTest, Skips_Comments_Block_Unterminated) {}

TEST_F(LexerTest, Null_InBlankspace_IsError) {}

TEST_F(LexerTest, Null_InLineComment_IsError) {}

TEST_F(LexerTest, Null_InBlockComment_IsError) {}

TEST_F(LexerTest, Null_InIdentifier_IsError) {}

struct FloatData {};
inline std::ostream& operator<<(std::ostream& out, FloatData data) {}
FloatTest;
TEST_P(FloatTest, Parse) {}
INSTANTIATE_TEST_SUITE_P();

FloatTest_Invalid;
TEST_P(FloatTest_Invalid, Handles) {}
INSTANTIATE_TEST_SUITE_P();

AsciiIdentifierTest;
TEST_P(AsciiIdentifierTest, Parse) {}
INSTANTIATE_TEST_SUITE_P();

struct UnicodeCase {};

ValidUnicodeIdentifierTest;
TEST_P(ValidUnicodeIdentifierTest, Parse) {}
INSTANTIATE_TEST_SUITE_P();

InvalidUnicodeIdentifierTest;
TEST_P(InvalidUnicodeIdentifierTest, Parse) {}
INSTANTIATE_TEST_SUITE_P();

TEST_F(LexerTest, IdentifierTest_SingleUnderscoreDoesNotMatch) {}

TEST_F(LexerTest, IdentifierTest_DoesNotStartWithDoubleUnderscore) {}

TEST_F(LexerTest, IdentifierTest_DoesNotStartWithNumber) {}

////////////////////////////////////////////////////////////////////////////////
// ParseIntegerTest
////////////////////////////////////////////////////////////////////////////////
struct ParseIntegerCase {};

inline std::ostream& operator<<(std::ostream& out, ParseIntegerCase data) {}

ParseIntegerTest;
TEST_P(ParseIntegerTest, Parse) {}

INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();
////////////////////////////////////////////////////////////////////////////////
// ParseIntegerTest_CannotBeRepresented
////////////////////////////////////////////////////////////////////////////////
ParseIntegerTest_CannotBeRepresented;
TEST_P(ParseIntegerTest_CannotBeRepresented, Parse) {}
INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

////////////////////////////////////////////////////////////////////////////////
// ParseIntegerTest_LeadingZeros
////////////////////////////////////////////////////////////////////////////////
ParseIntegerTest_LeadingZeros;
TEST_P(ParseIntegerTest_LeadingZeros, Parse) {}

INSTANTIATE_TEST_SUITE_P();

////////////////////////////////////////////////////////////////////////////////
// ParseIntegerTest_NoSignificantDigits
////////////////////////////////////////////////////////////////////////////////
ParseIntegerTest_NoSignificantDigits;
TEST_P(ParseIntegerTest_NoSignificantDigits, Parse) {}

INSTANTIATE_TEST_SUITE_P();

struct TokenData {};
inline std::ostream& operator<<(std::ostream& out, TokenData data) {}
PunctuationTest;
TEST_P(PunctuationTest, Parses) {}
INSTANTIATE_TEST_SUITE_P();

SplittablePunctuationTest;
TEST_P(SplittablePunctuationTest, Parses) {}
INSTANTIATE_TEST_SUITE_P();

KeywordTest;
TEST_P(KeywordTest, Parses) {}
INSTANTIATE_TEST_SUITE_P();

}  // namespace
}  // namespace tint::wgsl::reader