17#include <jau/test/catch2_ext.hpp>
53 JAU_MAKE_ENUM_INFO(
fmode_t,
none,
sock,
blk,
chr,
fifo,
dir,
file,
link,
no_access,
not_existing);
54 JAU_MAKE_ENUM_INFO(
mountflags_linux,
none,
rdonly,
nosuid,
nodev,
noexec,
synchronous,
remount,
mandlock,
dirsync,
noatime,
55 nodiratime,
bind,
move,
rec,
silent,
posixacl,
unbindable,
private_,
slave,
shared,
relatime,
59template<
typename enum_info_t>
64 typedef typename enum_info_t::iterator iterator;
65 typedef typename enum_info_t::value_type enum_t;
66 const enum_info_t& ei = enum_info_t::get();
67 std::cout << ei << std::endl;
68 std::cout <<
"Enum type: " << ei.name() << std::endl;
70 for(iterator iter = ei.begin(); iter != ei.end(); ++iter, ++i) {
72 std::cout <<
"#" << i <<
": " << ev <<
", value: " << std::to_string( *ev ) << std::endl;
74 REQUIRE( size == enum_info_t::size() );
77TEST_CASE(
"Enum Class Value Type Test 10",
"[enum][type]" ) {
97 for(std::string_view sv : nt.names) {
98 std::cout <<
"NameTable: val -> string: " << sv << std::endl;
99 REQUIRE(
false == sv.empty() );
103 std::cout <<
"ValueTable: val: " <<
static_cast<int>(v) << std::endl;
109 static_assert( 4 == test_type2_t_info_t::size() );
118 static_assert( 4 == test_type3_t_info_t::size() );
168TEST_CASE(
"Enum Class Value Type Test 11",
"[enum][type]" ) {
171 static_assert( 3 == test_type4_t_info_t::size() );
189 static_assert( 3 == test_type5_t_info_t::size() );
std::string to_string(const endian_t v) noexcept
Return std::string representation of the given endian.
consteval_cxx20 std::string_view name() noexcept
constexpr std::underlying_type_t< E > number(const E v) noexcept
consteval_cxx20 NameTable< Vargs... > get_names() noexcept
#define JAU_MAKE_ENUM_STRING(type,...)
constexpr ValueTable< std::common_type_t< Args... >, sizeof...(Args)> get_values(Args... args) noexcept
#define JAU_MAKE_BITFIELD_ENUM_STRING(type,...)
consteval_cxx20 bool is_enum() noexcept
consteval_cxx20 std::string_view long_name() noexcept
#define JAU_MAKE_ENUM_INFO(type,...)
fmode_t
Generic file type and POSIX protection mode bits as used in file_stats, touch(), mkdir() etc.
mountflags_linux
Flag bit values for mount() flags under GNU/Linux.
@ no_access
Type: Entity gives no access to user, exclusive bit.
@ link
Type: Entity is a symbolic link, might be in combination with file or dir, fifo, chr,...
@ sock
Type: Entity is a socket, might be in combination with link.
@ chr
Type: Entity is a character device, might be in combination with link.
@ dir
Type: Entity is a directory, might be in combination with link.
@ file
Type: Entity is a file, might be in combination with link.
@ blk
Type: Entity is a block device, might be in combination with link.
@ not_existing
Type: Entity does not exist, exclusive bit.
@ fifo
Type: Entity is a fifo/pipe, might be in combination with link.
Author: Sven Gothel sgothel@jausoft.com Copyright Gothel Software e.K.
Author: Sven Gothel sgothel@jausoft.com Copyright (c) 2022 Gothel Software e.K.
void test_enum_info(size_t size)
TEST_CASE("Enum Class Value Type Test 10", "[enum][type]")
test_type1_t
Author: Sven Gothel sgothel@jausoft.com Copyright Gothel Software e.K.