test_swprintf.cpp 704 B

123456789101112131415161718192021
  1. #include <gtest/gtest.h>
  2. extern "C"{
  3. #include "common.h"
  4. #include "palcommon.h"
  5. #include "text.h"
  6. }
  7. TEST(sdlpal, PALswprintf) {
  8. WCHAR test_buf[256];
  9. EXPECT_EQ(0, wcsncmp( L"测试", test_buf, PAL_swprintf(test_buf, sizeof(test_buf)/sizeof(WCHAR), L"%ls%ls", L"测", L"试")));
  10. }
  11. TEST(sdlpal, PALswprintf2) {
  12. WCHAR test_buf[256];
  13. EXPECT_EQ(0, wcsncmp( L"测试 2", test_buf, PAL_swprintf(test_buf, sizeof(test_buf)/sizeof(WCHAR), L"%ls%ls %d", L"测", L"试", 2)));
  14. }
  15. TEST(sdlpal, PALswprintf3) {
  16. WCHAR test_buf[256];
  17. EXPECT_EQ(0, wcsncmp( L"测试 3", test_buf, PAL_swprintf(test_buf, sizeof(test_buf)/sizeof(WCHAR), L"%ls%ls %c", L"测", L"试", '3')));
  18. }