Move is_emoji test to separate file.
This commit is contained in:
parent
de5f047dba
commit
6377a15d02
@ -305,6 +305,7 @@ set(TDUTILS_TEST_SOURCE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ChainScheduler.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ConcurrentHashMap.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/crypto.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/emoji.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Enumerator.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/EpochBasedMemoryReclamation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/filesystem.cpp
|
||||
|
29
tdutils/test/emoji.cpp
Normal file
29
tdutils/test/emoji.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#include "td/utils/emoji.h"
|
||||
#include "td/utils/tests.h"
|
||||
|
||||
TEST(Misc, is_emoji) {
|
||||
ASSERT_TRUE(td::is_emoji("π©πΌββ€βπβπ©π»"));
|
||||
ASSERT_TRUE(td::is_emoji("π©πΌββ€οΈβπβπ©π»"));
|
||||
ASSERT_TRUE(!td::is_emoji("π©πΌββ€οΈοΈβπβπ©π»"));
|
||||
ASSERT_TRUE(td::is_emoji("β"));
|
||||
ASSERT_TRUE(td::is_emoji("β"));
|
||||
ASSERT_TRUE(td::is_emoji("πͺ"));
|
||||
ASSERT_TRUE(td::is_emoji("2οΈβ£"));
|
||||
ASSERT_TRUE(td::is_emoji("2β£"));
|
||||
ASSERT_TRUE(!td::is_emoji(" 2β£"));
|
||||
ASSERT_TRUE(!td::is_emoji("2β£ "));
|
||||
ASSERT_TRUE(!td::is_emoji(" "));
|
||||
ASSERT_TRUE(!td::is_emoji(""));
|
||||
ASSERT_TRUE(!td::is_emoji("1234567890123456789012345678901234567890123456789012345678901234567890"));
|
||||
ASSERT_TRUE(td::is_emoji("β€οΈ"));
|
||||
ASSERT_TRUE(td::is_emoji("β€"));
|
||||
ASSERT_TRUE(td::is_emoji("β"));
|
||||
ASSERT_TRUE(td::is_emoji("π"));
|
||||
ASSERT_TRUE(td::is_emoji("π§βπ"));
|
||||
}
|
@ -11,7 +11,6 @@
|
||||
#include "td/utils/bits.h"
|
||||
#include "td/utils/CancellationToken.h"
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/emoji.h"
|
||||
#include "td/utils/ExitGuard.h"
|
||||
#include "td/utils/Hash.h"
|
||||
#include "td/utils/HashMap.h"
|
||||
@ -1215,27 +1214,6 @@ TEST(Misc, uname) {
|
||||
ASSERT_TRUE(!first_version.empty());
|
||||
}
|
||||
|
||||
TEST(Misc, is_emoji) {
|
||||
ASSERT_TRUE(td::is_emoji("π©πΌββ€βπβπ©π»"));
|
||||
ASSERT_TRUE(td::is_emoji("π©πΌββ€οΈβπβπ©π»"));
|
||||
ASSERT_TRUE(!td::is_emoji("π©πΌββ€οΈοΈβπβπ©π»"));
|
||||
ASSERT_TRUE(td::is_emoji("β"));
|
||||
ASSERT_TRUE(td::is_emoji("β"));
|
||||
ASSERT_TRUE(td::is_emoji("πͺ"));
|
||||
ASSERT_TRUE(td::is_emoji("2οΈβ£"));
|
||||
ASSERT_TRUE(td::is_emoji("2β£"));
|
||||
ASSERT_TRUE(!td::is_emoji(" 2β£"));
|
||||
ASSERT_TRUE(!td::is_emoji("2β£ "));
|
||||
ASSERT_TRUE(!td::is_emoji(" "));
|
||||
ASSERT_TRUE(!td::is_emoji(""));
|
||||
ASSERT_TRUE(!td::is_emoji("1234567890123456789012345678901234567890123456789012345678901234567890"));
|
||||
ASSERT_TRUE(td::is_emoji("β€οΈ"));
|
||||
ASSERT_TRUE(td::is_emoji("β€"));
|
||||
ASSERT_TRUE(td::is_emoji("β"));
|
||||
ASSERT_TRUE(td::is_emoji("π"));
|
||||
ASSERT_TRUE(td::is_emoji("π§βπ"));
|
||||
}
|
||||
|
||||
TEST(Misc, serialize) {
|
||||
td::int32 x = 1;
|
||||
ASSERT_EQ(td::base64_encode(td::serialize(x)), td::base64_encode(td::string("\x01\x00\x00\x00", 4)));
|
||||
|
Loadingβ¦
Reference in New Issue
Block a user