35 line_info& operator=(
const line_info&) =
default;
36 bool operator==(
const line_info& li)
const {
return this->member_name_ == li.member_name_ && this->file_path_ == li.file_path_ && this->line_number_ == li.line_number_;}
37 bool operator!=(
const line_info& li)
const {
return !this->operator==(li);}
42 const std::string&
member_name() const noexcept {
return this->member_name_;}
46 const std::string&
file_path() const noexcept {
return this->file_path_;}
50 unsigned int line_number() const noexcept {
return this->line_number_;}
53 friend std::ostream& operator<<(std::ostream& os,
const tunit::line_info line_info) noexcept {
54 if (line_info.file_path_ ==
"" && line_info.line_number_ == 0 && line_info.member_name_ ==
"")
55 return os <<
"{Empty}";
56 if (line_info.member_name_ ==
"")
57 return os <<
"{file_path=\"" << line_info.file_path_ <<
"\", line_number=" << line_info.line_number_<<
"}";
58 return os <<
"{member_name=\"" << line_info.member_name_ <<
"\", file_path=\"" << line_info.file_path_ <<
"\", line_number=" << line_info.line_number_<<
"}";
63 std::string member_name_;
64 std::string file_path_;
65 unsigned int line_number_ = 0;
76 tunit::line_info {__func__, __FILE__, __LINE__} unsigned int line_number() const noexcept
Gets the line number.
Definition: line_info.h:50
line_info(const std::string &member_name, const std::string &file_path, unsigned int line_number) noexcept
Creates new instance of line info with member name specified, file path specified, and line number specified.
Definition: line_info.h:27
const std::string & member_name() const noexcept
Gets the member name.
Definition: line_info.h:42
static tunit::line_info empty()
Return an empty line info.
Definition: line_info.h:31
line_info information class is used to store current file, current line and current function informat...
Definition: line_info.h:13
line_info(const std::string &file_path, unsigned int line_number) noexcept
Creates new instance of line info with file path specified, and line number specified.
Definition: line_info.h:21
The tunit namespace contains a unit test library.
Definition: abort_error.h:8
const std::string & file_path() const noexcept
Gets the file path.
Definition: line_info.h:46
line_info() noexcept=default
Creates new instance of line info.