1//
2// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7#include "PreprocessorTest.h"
8#include "Token.h"
9
10void PreprocessorTest::preprocess(const char* input, const char* expected)
11{
12    ASSERT_TRUE(mPreprocessor.init(1, &input, NULL));
13
14    int line = 1;
15    pp::Token token;
16    std::stringstream stream;
17    do
18    {
19        mPreprocessor.lex(&token);
20        for (; line < token.location.line; ++line)
21        {
22            stream << "\n";
23        }
24        stream << token;
25    } while (token.type != pp::Token::LAST);
26
27    std::string actual = stream.str();
28    EXPECT_STREQ(expected, actual.c_str());
29}
30