You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include "rtc_base/stringize_macros.h"
  11. #include "test/gtest.h"
  12. // Macros as per documentation in header file.
  13. #define PREPROCESSOR_UTIL_UNITTEST_A FOO
  14. #define PREPROCESSOR_UTIL_UNITTEST_B(x) myobj->FunctionCall(x)
  15. #define PREPROCESSOR_UTIL_UNITTEST_C "foo"
  16. TEST(StringizeTest, Ansi) {
  17. EXPECT_STREQ("PREPROCESSOR_UTIL_UNITTEST_A",
  18. STRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_A));
  19. EXPECT_STREQ("PREPROCESSOR_UTIL_UNITTEST_B(y)",
  20. STRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_B(y)));
  21. EXPECT_STREQ("PREPROCESSOR_UTIL_UNITTEST_C",
  22. STRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_C));
  23. EXPECT_STREQ("FOO", STRINGIZE(PREPROCESSOR_UTIL_UNITTEST_A));
  24. EXPECT_STREQ("myobj->FunctionCall(y)",
  25. STRINGIZE(PREPROCESSOR_UTIL_UNITTEST_B(y)));
  26. EXPECT_STREQ("\"foo\"", STRINGIZE(PREPROCESSOR_UTIL_UNITTEST_C));
  27. }