mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-05 05:27:58 +08:00
21 lines
644 B
C++
21 lines
644 B
C++
#include "tkc/str_str.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
#include <string>
|
|
|
|
using std::string;
|
|
|
|
static str_str_t items[] = {{"click", "CLICK"}, {"pointer", "POINTER"}, {NULL, NULL}};
|
|
|
|
TEST(StrStr, name) {
|
|
ASSERT_EQ(string(str_str_name(items, "CLICK")), string("click"));
|
|
ASSERT_EQ(string(str_str_name(items, "POINTER")), string("pointer"));
|
|
ASSERT_EQ(str_str_name(items, "NOT EXIST"), (const char*)NULL);
|
|
}
|
|
|
|
TEST(StrStr, value) {
|
|
ASSERT_EQ(string(str_str_value(items, "click")), string("CLICK"));
|
|
ASSERT_EQ(string(str_str_value(items, "pointer")), string("POINTER"));
|
|
ASSERT_EQ(str_str_value(items, "NOT EXIST"), (const char*)NULL);
|
|
}
|