refactor: rename flag_enum to cenum.
- rename flag_enum to cenum because it not only provide functions related to flag enum, but also make C++ enum used like C enum.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <yycc.hpp>
|
||||
#include <yycc/carton/termcolor.hpp>
|
||||
#include <yycc/flag_enum.hpp>
|
||||
#include <yycc/cenum.hpp>
|
||||
|
||||
#define TERMCOLOR ::yycc::carton::termcolor
|
||||
#define FLAG_ENUM ::yycc::flag_enum
|
||||
#define CENUM ::yycc::cenum
|
||||
|
||||
using namespace std::literals::string_view_literals;
|
||||
using Color = TERMCOLOR::Color;
|
||||
@@ -23,7 +23,7 @@ namespace yycctest::carton::termcolor {
|
||||
|
||||
EXPECT_EQ(TERMCOLOR::style(Attribute::Default), u8"");
|
||||
EXPECT_EQ(TERMCOLOR::style(Attribute::Italic), u8"\033[3m");
|
||||
EXPECT_EQ(TERMCOLOR::styles(FLAG_ENUM::merge(Attribute::Italic, Attribute::Bold)),
|
||||
EXPECT_EQ(TERMCOLOR::styles(CENUM::merge(Attribute::Italic, Attribute::Bold)),
|
||||
u8"\033[1m"
|
||||
"\033[3m");
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace yycctest::carton::termcolor {
|
||||
|
||||
TEST(CartonTermcolor, Highlevel) {
|
||||
EXPECT_EQ(TERMCOLOR::colored(u8"hello"sv), u8"hello\033[0m");
|
||||
EXPECT_EQ(TERMCOLOR::colored(u8"hello"sv, Color::LightWhite, Color::Red, FLAG_ENUM::merge(Attribute::Italic, Attribute::Bold)),
|
||||
EXPECT_EQ(TERMCOLOR::colored(u8"hello"sv, Color::LightWhite, Color::Red, CENUM::merge(Attribute::Italic, Attribute::Bold)),
|
||||
u8"\033[97m"
|
||||
"\033[41m"
|
||||
"\033[1m"
|
||||
|
||||
Reference in New Issue
Block a user