Showing preview only (2,358K chars total). Download the full file or copy to clipboard to get everything.
Repository: Winnerhust/inifile2
Branch: master
Commit: 53b139e77f60
Files: 165
Total size: 2.2 MB
Directory structure:
gitextract_oz4sj7oe/
├── .github/
│ └── workflows/
│ └── ccpp.yml
├── .gitignore
├── CMakeLists.txt
├── README.md
├── build.sh
├── src/
│ ├── CMakeLists.txt
│ ├── inifile.cpp
│ └── inifile.h
└── test/
├── CMakeLists.txt
├── googletest/
│ ├── CMakeLists.txt
│ ├── CONTRIBUTORS
│ ├── LICENSE
│ ├── README.md
│ ├── cmake/
│ │ ├── Config.cmake.in
│ │ ├── gtest.pc.in
│ │ ├── gtest_main.pc.in
│ │ ├── internal_utils.cmake
│ │ └── libgtest.la.in
│ ├── docs/
│ │ ├── advanced.md
│ │ ├── faq.md
│ │ ├── pkgconfig.md
│ │ ├── primer.md
│ │ └── samples.md
│ ├── include/
│ │ └── gtest/
│ │ ├── gtest-death-test.h
│ │ ├── gtest-matchers.h
│ │ ├── gtest-message.h
│ │ ├── gtest-param-test.h
│ │ ├── gtest-printers.h
│ │ ├── gtest-spi.h
│ │ ├── gtest-test-part.h
│ │ ├── gtest-typed-test.h
│ │ ├── gtest.h
│ │ ├── gtest_pred_impl.h
│ │ ├── gtest_prod.h
│ │ └── internal/
│ │ ├── custom/
│ │ │ ├── README.md
│ │ │ ├── gtest-port.h
│ │ │ ├── gtest-printers.h
│ │ │ └── gtest.h
│ │ ├── gtest-death-test-internal.h
│ │ ├── gtest-filepath.h
│ │ ├── gtest-internal.h
│ │ ├── gtest-param-util.h
│ │ ├── gtest-port-arch.h
│ │ ├── gtest-port.h
│ │ ├── gtest-string.h
│ │ └── gtest-type-util.h
│ ├── samples/
│ │ ├── prime_tables.h
│ │ ├── sample1.cc
│ │ ├── sample1.h
│ │ ├── sample10_unittest.cc
│ │ ├── sample1_unittest.cc
│ │ ├── sample2.cc
│ │ ├── sample2.h
│ │ ├── sample2_unittest.cc
│ │ ├── sample3-inl.h
│ │ ├── sample3_unittest.cc
│ │ ├── sample4.cc
│ │ ├── sample4.h
│ │ ├── sample4_unittest.cc
│ │ ├── sample5_unittest.cc
│ │ ├── sample6_unittest.cc
│ │ ├── sample7_unittest.cc
│ │ ├── sample8_unittest.cc
│ │ └── sample9_unittest.cc
│ ├── scripts/
│ │ ├── README.md
│ │ ├── common.py
│ │ ├── fuse_gtest_files.py
│ │ ├── gen_gtest_pred_impl.py
│ │ ├── gtest-config.in
│ │ ├── release_docs.py
│ │ ├── run_with_path.py
│ │ ├── test/
│ │ │ └── Makefile
│ │ ├── upload.py
│ │ └── upload_gtest.py
│ ├── src/
│ │ ├── gtest-all.cc
│ │ ├── gtest-death-test.cc
│ │ ├── gtest-filepath.cc
│ │ ├── gtest-internal-inl.h
│ │ ├── gtest-matchers.cc
│ │ ├── gtest-port.cc
│ │ ├── gtest-printers.cc
│ │ ├── gtest-test-part.cc
│ │ ├── gtest-typed-test.cc
│ │ ├── gtest.cc
│ │ └── gtest_main.cc
│ └── test/
│ ├── BUILD.bazel
│ ├── googletest-break-on-failure-unittest.py
│ ├── googletest-break-on-failure-unittest_.cc
│ ├── googletest-catch-exceptions-test.py
│ ├── googletest-catch-exceptions-test_.cc
│ ├── googletest-color-test.py
│ ├── googletest-color-test_.cc
│ ├── googletest-death-test-test.cc
│ ├── googletest-death-test_ex_test.cc
│ ├── googletest-env-var-test.py
│ ├── googletest-env-var-test_.cc
│ ├── googletest-filepath-test.cc
│ ├── googletest-filter-unittest.py
│ ├── googletest-filter-unittest_.cc
│ ├── googletest-json-outfiles-test.py
│ ├── googletest-json-output-unittest.py
│ ├── googletest-list-tests-unittest.py
│ ├── googletest-list-tests-unittest_.cc
│ ├── googletest-listener-test.cc
│ ├── googletest-message-test.cc
│ ├── googletest-options-test.cc
│ ├── googletest-output-test-golden-lin.txt
│ ├── googletest-output-test.py
│ ├── googletest-output-test_.cc
│ ├── googletest-param-test-invalid-name1-test.py
│ ├── googletest-param-test-invalid-name1-test_.cc
│ ├── googletest-param-test-invalid-name2-test.py
│ ├── googletest-param-test-invalid-name2-test_.cc
│ ├── googletest-param-test-test.cc
│ ├── googletest-param-test-test.h
│ ├── googletest-param-test2-test.cc
│ ├── googletest-port-test.cc
│ ├── googletest-printers-test.cc
│ ├── googletest-shuffle-test.py
│ ├── googletest-shuffle-test_.cc
│ ├── googletest-test-part-test.cc
│ ├── googletest-test2_test.cc
│ ├── googletest-throw-on-failure-test.py
│ ├── googletest-throw-on-failure-test_.cc
│ ├── googletest-uninitialized-test.py
│ ├── googletest-uninitialized-test_.cc
│ ├── gtest-typed-test2_test.cc
│ ├── gtest-typed-test_test.cc
│ ├── gtest-typed-test_test.h
│ ├── gtest-unittest-api_test.cc
│ ├── gtest_all_test.cc
│ ├── gtest_assert_by_exception_test.cc
│ ├── gtest_environment_test.cc
│ ├── gtest_help_test.py
│ ├── gtest_help_test_.cc
│ ├── gtest_json_test_utils.py
│ ├── gtest_list_output_unittest.py
│ ├── gtest_list_output_unittest_.cc
│ ├── gtest_main_unittest.cc
│ ├── gtest_no_test_unittest.cc
│ ├── gtest_pred_impl_unittest.cc
│ ├── gtest_premature_exit_test.cc
│ ├── gtest_prod_test.cc
│ ├── gtest_repeat_test.cc
│ ├── gtest_skip_check_output_test.py
│ ├── gtest_skip_environment_check_output_test.py
│ ├── gtest_skip_in_environment_setup_test.cc
│ ├── gtest_skip_test.cc
│ ├── gtest_sole_header_test.cc
│ ├── gtest_stress_test.cc
│ ├── gtest_test_macro_stack_footprint_test.cc
│ ├── gtest_test_utils.py
│ ├── gtest_testbridge_test.py
│ ├── gtest_testbridge_test_.cc
│ ├── gtest_throw_on_failure_ex_test.cc
│ ├── gtest_unittest.cc
│ ├── gtest_xml_outfile1_test_.cc
│ ├── gtest_xml_outfile2_test_.cc
│ ├── gtest_xml_outfiles_test.py
│ ├── gtest_xml_output_unittest.py
│ ├── gtest_xml_output_unittest_.cc
│ ├── gtest_xml_test_utils.py
│ ├── production.cc
│ └── production.h
└── inifile_test.cpp
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/ccpp.yml
================================================
name: C/C++ CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: build_and_test
run: ./build.sh
================================================
FILE: .gitignore
================================================
*.o
*.log
mytest
error
================================================
FILE: CMakeLists.txt
================================================
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_subdirectory(src)
add_subdirectory(test)
================================================
FILE: README.md
================================================
inifile2
========
## 一个轻量级的inifile文件解析库
### 一. 使用介绍
* 支持解析ini文件
* 支持修改、保存ini文件
* 支持设置多个注释符,默认为“#”和';'
* 支持参数名重复
* 使用gtest和valgrind做过测试
使用很简单,生成一个ini文件test.ini
```
>cat > test.ini
#this is commit
;this is commit
[COMMON]
DB = mysql
PASSWD=root
```
首先指定头文件和命名空间 然后使用open函数打开ini文件 getValue可以获取指定段的指定项的值
```
#include "inifile.h"
using namespace inifile;
filepath = "test.ini";
IniFile ini;
ini.load(filepath);
//获取指定段的指定项的值
int ret = 0;
string db_name = ini.getValue("COMMON","DB",ret);
```
### 二. 本地测试构建方式
* 构建: `./build.sh`
* 清理: `./build.sh clean`
* 帮助: `./build.sh -h` 或者`./build.sh --help`
```
$./build.sh --help
usage: ./build.sh [clean] [-h|--help]
```
### 三. 如何引用inifile库
1. 源码引用:
编译时将src目录下的inifile.cpp 和inifile.h 拷贝到您的源码中直接进行编译即可,对于编译选项或者编译器有要求的建议使用这种源码拷贝的方式.
2. 二进制库引用:libinifile.so或者libinifile.a 引用
执行`./build.sh`后在build/lib目录下会生成libinifile.so和libinifile.a,您可以将这两个库添加到您的工程中,对应的头文件为inifile.h.
================================================
FILE: build.sh
================================================
#!/bin/bash
set -eu
function build_clean()
{
rm -rf build
}
function build_test()
{
mkdir -p build
cd build
cmake ..
make -j8
make test
}
function usage()
{
echo "usage: ./build.sh [clean] [-h|--help]"
}
opt=""
if [ $# -ge 1 ];then
opt=$1
fi
case "${opt}" in
clean)
build_clean
;;
-h|--help)
usage
;;
*)
build_test
;;
esac
================================================
FILE: src/CMakeLists.txt
================================================
add_library(inifile STATIC inifile.cpp)
add_library(inifile_share SHARED inifile.cpp)
add_custom_target(rename_share_so COMMAND mv ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libinifile_share.so ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libinifile.so )
add_dependencies(rename_share_so inifile_share)
add_dependencies(inifile rename_share_so)
================================================
FILE: src/inifile.cpp
================================================
/* Copyright (c) 2014-2019 WinnerHust
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* The names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <iostream>
#include <fstream>
#include "inifile.h"
namespace inifile
{
// 构造函数,会初始化注释字符集合flags_(容器),目前只使用#和;作为注释前缀
IniFile::IniFile()
:commentDelimiter("#")
{
}
//解析一行数据,得到键值
/* --------------------------------------------------------------------------*/
/**
* @brief parse
*
* @param content 数据源指针
* @param key 键名
* @param value 键值
* @param c 分隔符
*
* @return bool
*/
/* ----------------------------------------------------------------------------*/
bool IniFile::parse(const string &content, string *key, string *value)
{
return split(content, "=", key, value);
}
int IniFile::UpdateSection(const string &cleanLine, const string &comment,
const string &rightComment, IniSection **section)
{
IniSection *newSection;
// 查找右中括号
size_t index = cleanLine.find_first_of(']');
if (index == string::npos) {
errMsg = string("no matched ] found");
return ERR_UNMATCHED_BRACKETS;
}
int len = index - 1;
// 若段名为空,继续下一行
if (len <= 0) {
errMsg = string("section name is empty");
return ERR_SECTION_EMPTY;
}
// 取段名
string s(cleanLine, 1, len);
trim(s);
//检查段是否已存在
if (getSection(s) != NULL) {
errMsg = string("section ") + s + string("already exist");
return ERR_SECTION_ALREADY_EXISTS;
}
// 申请一个新段,由于map容器会自动排序,打乱原有顺序,因此改用vector存储(sections_vt)
newSection = new IniSection();
// 填充段名
newSection->name = s;
// 填充段开头的注释
newSection->comment = comment;
newSection->rightComment = rightComment;
sections_vt.push_back(newSection);
*section = newSection;
return 0;
}
int IniFile::AddKeyValuePair(const string &cleanLine, const string &comment,
const string &rightComment, IniSection *section)
{
string key, value;
if (!parse(cleanLine, &key, &value)) {
errMsg = string("parse line failed:") + cleanLine;
return ERR_PARSE_KEY_VALUE_FAILED;
}
IniItem item;
item.key = key;
item.value = value;
item.comment = comment;
item.rightComment = rightComment;
section->items.push_back(item);
return 0;
}
int IniFile::Load(const string &filePath)
{
int err;
string line; // 带注释的行
string cleanLine; // 去掉注释后的行
string comment;
string rightComment;
IniSection *currSection = NULL; // 初始化一个字段指针
release();
iniFilePath = filePath;
std::ifstream ifs(iniFilePath);
if (!ifs.is_open()) {
errMsg = string("open") +iniFilePath+ string(" file failed");
return ERR_OPEN_FILE_FAILED;
}
//增加默认段,即 无名段""
currSection = new IniSection();
currSection->name = "";
sections_vt.push_back(currSection);
// 每次读取一行内容到line
while (std::getline(ifs, line)) {
trim(line);
// step 0,空行处理,如果长度为0,说明是空行,添加到comment,当作是注释的一部分
if (line.length() <= 0) {
comment += delim;
continue;
}
// step 1
// 如果行首不是注释,查找行尾是否存在注释
// 如果该行以注释开头,添加到comment,跳过当前循环,continue
if (IsCommentLine(line)) {
comment += line + delim;
continue;
}
// 如果行首不是注释,查找行尾是否存在注释,若存在,切割该行,将注释内容添加到rightComment
split(line, commentDelimiter, &cleanLine, &rightComment);
// step 2,判断line内容是否为段或键
//段开头查找 [
if (cleanLine[0] == '[') {
err = UpdateSection(cleanLine, comment, rightComment, &currSection);
} else {
// 如果该行是键值,添加到section段的items容器
err = AddKeyValuePair(cleanLine, comment, rightComment, currSection);
}
if (err != 0) {
ifs.close();
return err;
}
// comment清零
comment = "";
rightComment = "";
}
ifs.close();
return 0;
}
int IniFile::Save()
{
return SaveAs(iniFilePath);
}
int IniFile::SaveAs(const string &filePath)
{
string data = "";
/* 载入section数据 */
for (IniSection_it sect = sections_vt.begin(); sect != sections_vt.end(); ++sect) {
if ((*sect)->comment != "") {
data += (*sect)->comment;
}
if ((*sect)->name != "") {
data += string("[") + (*sect)->name + string("]");
data += delim;
}
if ((*sect)->rightComment != "") {
data += " " + commentDelimiter +(*sect)->rightComment;
}
/* 载入item数据 */
for (IniSection::IniItem_it item = (*sect)->items.begin(); item != (*sect)->items.end(); ++item) {
if (item->comment != "") {
data += item->comment;
if (data[data.length()-1] != '\n') {
data += delim;
}
}
data += item->key + "=" + item->value;
if (item->rightComment != "") {
data += " " + commentDelimiter + item->rightComment;
}
if (data[data.length()-1] != '\n') {
data += delim;
}
}
}
std::ofstream ofs(filePath);
ofs << data;
ofs.close();
return 0;
}
IniSection *IniFile::getSection(const string §ion /*=""*/)
{
for (IniSection_it it = sections_vt.begin(); it != sections_vt.end(); ++it) {
if ((*it)->name == section) {
return *it;
}
}
return NULL;
}
int IniFile::GetSections(vector<string> *sections)
{
for (IniSection_it it = sections_vt.begin(); it != sections_vt.end(); ++it) {
sections->push_back((*it)->name);
}
return sections->size();
}
int IniFile::GetSectionNum()
{
return sections_vt.size();
}
int IniFile::GetStringValue(const string §ion, const string &key, string *value)
{
return getValue(section, key, value);
}
int IniFile::GetIntValue(const string §ion, const string &key, int *intValue)
{
int err;
string strValue;
err = getValue(section, key, &strValue);
*intValue = atoi(strValue.c_str());
return err;
}
int IniFile::GetDoubleValue(const string §ion, const string &key, double *value)
{
int err;
string strValue;
err = getValue(section, key, &strValue);
*value = atof(strValue.c_str());
return err;
}
int IniFile::GetBoolValue(const string §ion, const string &key, bool *value)
{
int err;
string strValue;
err = getValue(section, key, &strValue);
if (StringCmpIgnoreCase(strValue, "true") || StringCmpIgnoreCase(strValue, "1")) {
*value = true;
} else if (StringCmpIgnoreCase(strValue, "false") || StringCmpIgnoreCase(strValue, "0")) {
*value = false;
}
return err;
}
/* 获取section段第一个键为key的string值,成功返回获取的值,否则返回默认值 */
void IniFile::GetStringValueOrDefault(const string §ion, const string &key,
string *value, const string &defaultValue)
{
if (GetStringValue(section, key, value) != 0) {
*value = defaultValue;
}
return;
}
/* 获取section段第一个键为key的int值,成功返回获取的值,否则返回默认值 */
void IniFile::GetIntValueOrDefault(const string §ion, const string &key, int *value, int defaultValue)
{
if (GetIntValue(section, key, value) != 0) {
*value = defaultValue;
}
return;
}
/* 获取section段第一个键为key的double值,成功返回获取的值,否则返回默认值 */
void IniFile::GetDoubleValueOrDefault(const string §ion, const string &key, double *value, double defaultValue)
{
if (GetDoubleValue(section, key, value) != 0) {
*value = defaultValue;
}
return;
}
/* 获取section段第一个键为key的bool值,成功返回获取的值,否则返回默认值 */
void IniFile::GetBoolValueOrDefault(const string §ion, const string &key, bool *value, bool defaultValue)
{
if (GetBoolValue(section, key, value) != 0) {
*value = defaultValue;
}
return;
}
/* 获取注释,如果key=""则获取段注释 */
int IniFile::GetComment(const string §ion, const string &key, string *comment)
{
IniSection *sect = getSection(section);
if (sect == NULL) {
errMsg = string("not find the section ")+section;
return ERR_NOT_FOUND_SECTION;
}
if (key == "") {
*comment = sect->comment;
return RET_OK;
}
for (IniSection::IniItem_it it = sect->begin(); it != sect->end(); ++it) {
if (it->key == key) {
*comment = it->comment;
return RET_OK;
}
}
errMsg = string("not find the key ")+section;
return ERR_NOT_FOUND_KEY;
}
/* 获取行尾注释,如果key=""则获取段的行尾注释 */
int IniFile::GetRightComment(const string §ion, const string &key, string *rightComment)
{
IniSection *sect = getSection(section);
if (sect == NULL) {
errMsg = string("not find the section ")+section;
return ERR_NOT_FOUND_SECTION;
}
if (key == "") {
*rightComment = sect->rightComment;
return RET_OK;
}
for (IniSection::IniItem_it it = sect->begin(); it != sect->end(); ++it) {
if (it->key == key) {
*rightComment = it->rightComment;
return RET_OK;
}
}
errMsg = string("not find the key ")+key;
return ERR_NOT_FOUND_KEY;
}
int IniFile::getValue(const string §ion, const string &key, string *value)
{
string comment;
return getValue(section, key, value, &comment);
}
int IniFile::getValue(const string §ion, const string &key, string *value, string *comment)
{
IniSection *sect = getSection(section);
if (sect == NULL) {
errMsg = string("not find the section ")+section;
return ERR_NOT_FOUND_SECTION;
}
for (IniSection::IniItem_it it = sect->begin(); it != sect->end(); ++it) {
if (it->key == key) {
*value = it->value;
*comment = it->comment;
return RET_OK;
}
}
errMsg = string("not find the key ")+key;
return ERR_NOT_FOUND_KEY;
}
int IniFile::GetValues(const string §ion, const string &key, vector<string> *values)
{
vector<string> comments;
return GetValues(section, key, values, &comments);
}
int IniFile::GetValues(const string §ion, const string &key, vector<string> *values, vector<string> *comments)
{
string value, comment;
values->clear();
comments->clear();
IniSection *sect = getSection(section);
if (sect == NULL) {
errMsg = string("not find the section ")+section;
return ERR_NOT_FOUND_SECTION;
}
for (IniSection::IniItem_it it = sect->begin(); it != sect->end(); ++it) {
if (it->key == key) {
value = it->value;
comment = it->comment;
values->push_back(value);
comments->push_back(comment);
}
}
if (values->size() == 0) {
errMsg = string("not find the key ")+key;
return ERR_NOT_FOUND_KEY;
}
return RET_OK;
}
bool IniFile::HasSection(const string §ion)
{
return (getSection(section) != NULL);
}
bool IniFile::HasKey(const string §ion, const string &key)
{
IniSection *sect = getSection(section);
if (sect != NULL) {
for (IniSection::IniItem_it it = sect->begin(); it != sect->end(); ++it) {
if (it->key == key) {
return true;
}
}
}
return false;
}
int IniFile::setValue(const string §ion, const string &key, const string &value, const string &comment /*=""*/)
{
IniSection *sect = getSection(section);
string comt = comment;
if (comt != "") {
comt = commentDelimiter + comt;
}
if (sect == NULL) {
//如果段不存在,新建一个
sect = new IniSection();
if (sect == NULL) {
errMsg = string("no enough memory!");
return ERR_NO_ENOUGH_MEMORY;
}
sect->name = section;
if (sect->name == "") {
// 确保空section在第一个
sections_vt.insert(sections_vt.begin(), sect);
} else {
sections_vt.push_back(sect);
}
}
for (IniSection::IniItem_it it = sect->begin(); it != sect->end(); ++it) {
if (it->key == key) {
it->value = value;
it->comment = comt;
return RET_OK;
}
}
// not found key
IniItem item;
item.key = key;
item.value = value;
item.comment = comt;
sect->items.push_back(item);
return RET_OK;
}
int IniFile::SetStringValue(const string §ion, const string &key, const string &value)
{
return setValue(section, key, value);
}
int IniFile::SetIntValue(const string §ion, const string &key, int value)
{
char buf[64] = {0};
snprintf(buf, sizeof(buf), "%d", value);
return setValue(section, key, buf);
}
int IniFile::SetDoubleValue(const string §ion, const string &key, double value)
{
char buf[64] = {0};
snprintf(buf, sizeof(buf), "%f", value);
return setValue(section, key, buf);
}
int IniFile::SetBoolValue(const string §ion, const string &key, bool value)
{
if (value) {
return setValue(section, key, "true");
} else {
return setValue(section, key, "false");
}
}
int IniFile::SetComment(const string §ion, const string &key, const string &comment)
{
IniSection *sect = getSection(section);
if (sect == NULL) {
errMsg = string("Not find the section ")+section;
return ERR_NOT_FOUND_SECTION;
}
if (key == "") {
sect->comment = comment;
return RET_OK;
}
for (IniSection::IniItem_it it = sect->begin(); it != sect->end(); ++it) {
if (it->key == key) {
it->comment = comment;
return RET_OK;
}
}
errMsg = string("not find the key ")+key;
return ERR_NOT_FOUND_KEY;
}
int IniFile::SetRightComment(const string §ion, const string &key, const string &rightComment)
{
IniSection *sect = getSection(section);
if (sect == NULL) {
errMsg = string("Not find the section ")+section;
return ERR_NOT_FOUND_SECTION;
}
if (key == "") {
sect->rightComment = rightComment;
return RET_OK;
}
for (IniSection::IniItem_it it = sect->begin(); it != sect->end(); ++it) {
if (it->key == key) {
it->rightComment = rightComment;
return RET_OK;
}
}
errMsg = string("not find the key ")+key;
return ERR_NOT_FOUND_KEY;
}
void IniFile::SetCommentDelimiter(const string &delimiter)
{
commentDelimiter = delimiter;
}
void IniFile::DeleteSection(const string §ion)
{
for (IniSection_it it = sections_vt.begin(); it != sections_vt.end(); ) {
if ((*it)->name == section) {
delete *it;
it = sections_vt.erase(it);
break;
} else {
it++;
}
}
}
void IniFile::DeleteKey(const string §ion, const string &key)
{
IniSection *sect = getSection(section);
if (sect != NULL) {
for (IniSection::IniItem_it it = sect->begin(); it != sect->end();) {
if (it->key == key) {
it = sect->items.erase(it);
break;
} else {
it++;
}
}
}
}
/*-------------------------------------------------------------------------*/
/**
@brief release: 释放全部资源,清空容器
@param none
@return none
*/
/*--------------------------------------------------------------------------*/
void IniFile::release()
{
iniFilePath = "";
for (IniSection_it it = sections_vt.begin(); it != sections_vt.end(); ++it) {
delete (*it); // 清除section
}
sections_vt.clear();
}
/*-------------------------------------------------------------------------*/
/**
@brief 判断是否是注释
@param str 一个string变量
@return 如果是注释则为真
*/
/*--------------------------------------------------------------------------*/
bool IniFile::IsCommentLine(const string &str)
{
return StartWith(str, commentDelimiter);
}
/*-------------------------------------------------------------------------*/
/**
@brief print for debug
@param none
@return none
*/
/*--------------------------------------------------------------------------*/
void IniFile::print()
{
printf("############ print start ############\n");
printf("filePath:[%s]\n", iniFilePath.c_str());
printf("commentDelimiter:[%s]\n", commentDelimiter.c_str());
for (IniSection_it it = sections_vt.begin(); it != sections_vt.end(); ++it) {
printf("comment :[\n%s]\n", (*it)->comment.c_str());
printf("section :\n[%s]\n", (*it)->name.c_str());
if ((*it)->rightComment != "") {
printf("rightComment:\n%s", (*it)->rightComment.c_str());
}
for (IniSection::IniItem_it i = (*it)->items.begin(); i != (*it)->items.end(); ++i) {
printf(" comment :[\n%s]\n", i->comment.c_str());
printf(" parm :%s=%s\n", i->key.c_str(), i->value.c_str());
if (i->rightComment != "") {
printf(" rcomment:[\n%s]\n", i->rightComment.c_str());
}
}
}
printf("############ print end ############\n");
return;
}
const string & IniFile::GetErrMsg()
{
return errMsg;
}
bool IniFile::StartWith(const string &str, const string &prefix)
{
if (strncmp(str.c_str(), prefix.c_str(), prefix.size()) == 0) {
return true;
}
return false;
}
void IniFile::trimleft(string &str, char c /*=' '*/)
{
int len = str.length();
int i = 0;
while (str[i] == c && str[i] != '\0') {
i++;
}
if (i != 0) {
str = string(str, i, len - i);
}
}
void IniFile::trimright(string &str, char c /*=' '*/)
{
int i = 0;
int len = str.length();
for (i = len - 1; i >= 0; --i) {
if (str[i] != c) {
break;
}
}
str = string(str, 0, i + 1);
}
/*-------------------------------------------------------------------------*/
/**
@brief trim,整理一行字符串,去掉首尾空格
@param str string变量
*/
/*--------------------------------------------------------------------------*/
void IniFile::trim(string &str)
{
int len = str.length();
int i = 0;
while ((i < len) && isspace(str[i]) && (str[i] != '\0')) {
i++;
}
if (i != 0) {
str = string(str, i, len - i);
}
len = str.length();
for (i = len - 1; i >= 0; --i) {
if (!isspace(str[i])) {
break;
}
}
str = string(str, 0, i + 1);
}
/*-------------------------------------------------------------------------*/
/**
@brief split,用分隔符切割字符串
@param str 输入字符串
@param left_str 分隔后得到的左字符串
@param right_str 分隔后得到的右字符串(不包含seperator)
@param seperator 分隔符
@return pos
*/
/*--------------------------------------------------------------------------*/
bool IniFile::split(const string &str, const string &sep, string *pleft, string *pright)
{
size_t pos = str.find(sep);
string left, right;
if (pos != string::npos) {
left = string(str, 0, pos);
right = string(str, pos+1);
trim(left);
trim(right);
*pleft = left;
*pright = right;
return true;
} else {
left = str;
right = "";
trim(left);
*pleft = left;
*pright = right;
return false;
}
}
bool IniFile::StringCmpIgnoreCase(const string &str1, const string &str2)
{
string a = str1;
string b = str2;
transform(a.begin(), a.end(), a.begin(), towupper);
transform(b.begin(), b.end(), b.begin(), towupper);
return (a == b);
}
} /* namespace inifile */
================================================
FILE: src/inifile.h
================================================
/* Copyright (c) 2014-2019 WinnerHust
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* The names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef INIFILE_H_
#define INIFILE_H_
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
using std::string;
using std::vector;
#define RET_OK 0
// 没有找到匹配的]
#define ERR_UNMATCHED_BRACKETS 2
// 段为空
#define ERR_SECTION_EMPTY 3
// 段名已经存在
#define ERR_SECTION_ALREADY_EXISTS 4
// 解析key value失败
#define ERR_PARSE_KEY_VALUE_FAILED 5
// 打开文件失败
#define ERR_OPEN_FILE_FAILED 6
// 内存不足
#define ERR_NO_ENOUGH_MEMORY 7
// 没有找到对应的key
#define ERR_NOT_FOUND_KEY 8
// 没有找到对应的section
#define ERR_NOT_FOUND_SECTION 9
namespace inifile
{
const char delim[] = "\n";
struct IniItem {
string key;
string value;
string comment; // 每个键的注释,都是指该行上方的内容
string rightComment;
};
struct IniSection {
typedef vector<IniItem>::iterator IniItem_it; // 定义一个迭代器,即指向键元素的指针
IniItem_it begin() {
return items.begin(); // 段结构体的begin元素指向items的头指针
}
IniItem_it end() {
return items.end(); // 段结构体的begin元素指向items的尾指针
}
string name;
string comment; // 每个段的注释,都是指该行上方的内容
string rightComment;
vector<IniItem> items; // 键值项数组,一个段可以有多个键值,所有用vector来储存
};
class IniFile
{
public:
IniFile();
~IniFile() {
release();
}
public:
/* 打开并解析一个名为fname的INI文件 */
int Load(const string &fname);
/* 将内容保存到当前文件 */
int Save();
/* 将内容另存到一个名为fname的文件 */
int SaveAs(const string &fname);
/* 获取section段第一个键为key的string值,成功返回0,否则返回错误码 */
int GetStringValue(const string §ion, const string &key, string *value);
/* 获取section段第一个键为key的int值,成功返回0,否则返回错误码 */
int GetIntValue(const string §ion, const string &key, int *value);
/* 获取section段第一个键为key的double值,成功返回0,否则返回错误码 */
int GetDoubleValue(const string §ion, const string &key, double *value);
/* 获取section段第一个键为key的bool值,成功返回0,否则返回错误码 */
int GetBoolValue(const string §ion, const string &key, bool *value);
/* 获取注释,如果key=""则获取段注释 */
int GetComment(const string §ion, const string &key, string *comment);
/* 获取行尾注释,如果key=""则获取段的行尾注释 */
int GetRightComment(const string §ion, const string &key, string *rightComment);
/* 获取section段第一个键为key的string值,成功返回获取的值,否则返回默认值 */
void GetStringValueOrDefault(const string §ion, const string &key, string *value, const string &defaultValue);
/* 获取section段第一个键为key的int值,成功返回获取的值,否则返回默认值 */
void GetIntValueOrDefault(const string §ion, const string &key, int *value, int defaultValue);
/* 获取section段第一个键为key的double值,成功返回获取的值,否则返回默认值 */
void GetDoubleValueOrDefault(const string §ion, const string &key, double *value, double defaultValue);
/* 获取section段第一个键为key的bool值,成功返回获取的值,否则返回默认值 */
void GetBoolValueOrDefault(const string §ion, const string &key, bool *value, bool defaultValue);
/* 获取section段所有键为key的值,并将值赋到values的vector中 */
int GetValues(const string §ion, const string &key, vector<string> *values);
/* 获取section列表,并返回section个数 */
int GetSections(vector<string> *sections);
/* 获取section个数,至少存在一个空section */
int GetSectionNum();
/* 是否存在某个section */
bool HasSection(const string §ion);
/* 获取指定section的所有ken=value信息 */
IniSection *getSection(const string §ion = "");
/* 是否存在某个key */
bool HasKey(const string §ion, const string &key);
/* 设置字符串值 */
int SetStringValue(const string §ion, const string &key, const string &value);
/* 设置整形值 */
int SetIntValue(const string §ion, const string &key, int value);
/* 设置浮点数值 */
int SetDoubleValue(const string §ion, const string &key, double value);
/* 设置布尔值 */
int SetBoolValue(const string §ion, const string &key, bool value);
/* 设置注释,如果key=""则设置段注释 */
int SetComment(const string §ion, const string &key, const string &comment);
/* 设置行尾注释,如果key=""则设置段的行尾注释 */
int SetRightComment(const string §ion, const string &key, const string &rightComment);
/* 删除段 */
void DeleteSection(const string §ion);
/* 删除特定段的特定参数 */
void DeleteKey(const string §ion, const string &key);
/*设置注释分隔符,默认为"#" */
void SetCommentDelimiter(const string &delimiter);
const string &GetErrMsg();
private:
/* 获取section段所有键为key的值,并将值赋到values的vector中,,将注释赋到comments的vector中 */
int GetValues(const string §ion, const string &key, vector<string> *value, vector<string> *comments);
/* 同时设置值和注释 */
int setValue(const string §ion, const string &key, const string &value, const string &comment = "");
/* 去掉str前面的c字符 */
static void trimleft(string &str, char c = ' ');
/* 去掉str后面的c字符 */
static void trimright(string &str, char c = ' ');
/* 去掉str前面和后面的空格符,Tab符等空白符 */
static void trim(string &str);
/* 将字符串str按分割符delim分割成多个子串 */
private:
int UpdateSection(const string &cleanLine, const string &comment,
const string &rightComment, IniSection **section);
int AddKeyValuePair(const string &cleanLine, const string &comment,
const string &rightComment, IniSection *section);
void release();
bool split(const string &str, const string &sep, string *left, string *right);
bool IsCommentLine(const string &str);
bool parse(const string &content, string *key, string *value);
// for debug
void print();
private:
/* 获取section段第一个键为key的值,并将值赋到value中 */
int getValue(const string §ion, const string &key, string *value);
/* 获取section段第一个键为key的值,并将值赋到value中,将注释赋到comment中 */
int getValue(const string §ion, const string &key, string *value, string *comment);
bool StringCmpIgnoreCase(const string &str1, const string &str2);
bool StartWith(const string &str, const string &prefix);
private:
typedef vector<IniSection *>::iterator IniSection_it;
vector<IniSection *> sections_vt; // 用于存储段集合的vector容器
string iniFilePath;
string commentDelimiter;
string errMsg; // 保存出错时的错误信息
};
} // endof namespace inifile
#endif // INIFILE_H_
================================================
FILE: test/CMakeLists.txt
================================================
enable_testing()
add_subdirectory(googletest)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/googletest/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
add_executable(inifile_test inifile_test.cpp)
add_compile_options("-g -Wall")
target_link_libraries(inifile_test inifile gtest gtest_main)
add_dependencies(inifile_test inifile gtest gtest_main)
#规避make test不生效的问题
add_test(NAME testcase COMMAND inifile_test)
#设置-V,可以在执行测试用例的同时将用例信息打印出来
add_custom_target(test COMMAND ${CMAKE_CTEST_COMMAND} -V DEPENDS inifile_test)
================================================
FILE: test/googletest/CMakeLists.txt
================================================
########################################################################
# Note: CMake support is community-based. The maintainers do not use CMake
# internally.
#
# CMake build script for Google Test.
#
# To run the tests for Google Test itself on Linux, use 'make test' or
# ctest. You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.
# When other libraries are using a shared version of runtime libraries,
# Google Test also has to use one.
option(
gtest_force_shared_crt
"Use shared (DLL) run-time lib even when Google Test is built as static lib."
OFF)
option(gtest_build_tests "Build all of gtest's own tests." OFF)
option(gtest_build_samples "Build gtest's sample programs." OFF)
option(gtest_disable_pthreads "Disable uses of pthreads in gtest." OFF)
option(
gtest_hide_internal_symbols
"Build gtest with internal symbols hidden in shared libraries."
OFF)
# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
include(cmake/hermetic_build.cmake OPTIONAL)
if (COMMAND pre_project_set_up_hermetic_build)
pre_project_set_up_hermetic_build()
endif()
########################################################################
#
# Project-wide settings
# Name of the project.
#
# CMake files in this project can refer to the root source directory
# as ${gtest_SOURCE_DIR} and to the root binary directory as
# ${gtest_BINARY_DIR}.
# Language "C" is required for find_package(Threads).
# Project version:
if (CMAKE_VERSION VERSION_LESS 3.0)
project(gtest CXX C)
set(PROJECT_VERSION ${GOOGLETEST_VERSION})
else()
cmake_policy(SET CMP0048 NEW)
project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
endif()
cmake_minimum_required(VERSION 2.6.4)
if (POLICY CMP0063) # Visibility
cmake_policy(SET CMP0063 NEW)
endif (POLICY CMP0063)
if (COMMAND set_up_hermetic_build)
set_up_hermetic_build()
endif()
# These commands only run if this is the main project
if(CMAKE_PROJECT_NAME STREQUAL "gtest" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution")
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
else()
mark_as_advanced(
gtest_force_shared_crt
gtest_build_tests
gtest_build_samples
gtest_disable_pthreads
gtest_hide_internal_symbols)
endif()
if (gtest_hide_internal_symbols)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
endif()
# Define helper functions and macros used by Google Test.
include(cmake/internal_utils.cmake)
config_compiler_and_linker() # Defined in internal_utils.cmake.
# Create the CMake package file descriptors.
if (INSTALL_GTEST)
include(CMakePackageConfigHelpers)
set(cmake_package_name GTest)
set(targets_export_name ${cmake_package_name}Targets CACHE INTERNAL "")
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated" CACHE INTERNAL "")
set(cmake_files_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${cmake_package_name}")
set(version_file "${generated_dir}/${cmake_package_name}ConfigVersion.cmake")
write_basic_package_version_file(${version_file} VERSION ${GOOGLETEST_VERSION} COMPATIBILITY AnyNewerVersion)
install(EXPORT ${targets_export_name}
NAMESPACE ${cmake_package_name}::
DESTINATION ${cmake_files_install_dir})
set(config_file "${generated_dir}/${cmake_package_name}Config.cmake")
configure_package_config_file("${gtest_SOURCE_DIR}/cmake/Config.cmake.in"
"${config_file}" INSTALL_DESTINATION ${cmake_files_install_dir})
install(FILES ${version_file} ${config_file}
DESTINATION ${cmake_files_install_dir})
endif()
# Where Google Test's .h files can be found.
set(gtest_build_include_dirs
"${gtest_SOURCE_DIR}/include"
"${gtest_SOURCE_DIR}")
include_directories(${gtest_build_include_dirs})
########################################################################
#
# Defines the gtest & gtest_main libraries. User tests should link
# with one of them.
# Google Test libraries. We build them using more strict warnings than what
# are used for other targets, to ensure that gtest can be compiled by a user
# aggressive about warnings.
cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
# If the CMake version supports it, attach header directory information
# to the targets for when we are part of a parent build (ie being pulled
# in via add_subdirectory() rather than being a standalone build).
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
target_include_directories(gtest SYSTEM INTERFACE
"$<BUILD_INTERFACE:${gtest_build_include_dirs}>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
target_include_directories(gtest_main SYSTEM INTERFACE
"$<BUILD_INTERFACE:${gtest_build_include_dirs}>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
endif()
target_link_libraries(gtest_main PUBLIC gtest)
########################################################################
#
# Install rules
install_project(gtest gtest_main)
########################################################################
#
# Samples on how to link user tests with gtest or gtest_main.
#
# They are not built by default. To build them, set the
# gtest_build_samples option to ON. You can do it by running ccmake
# or specifying the -Dgtest_build_samples=ON flag when running cmake.
if (gtest_build_samples)
cxx_executable(sample1_unittest samples gtest_main samples/sample1.cc)
cxx_executable(sample2_unittest samples gtest_main samples/sample2.cc)
cxx_executable(sample3_unittest samples gtest_main)
cxx_executable(sample4_unittest samples gtest_main samples/sample4.cc)
cxx_executable(sample5_unittest samples gtest_main samples/sample1.cc)
cxx_executable(sample6_unittest samples gtest_main)
cxx_executable(sample7_unittest samples gtest_main)
cxx_executable(sample8_unittest samples gtest_main)
cxx_executable(sample9_unittest samples gtest)
cxx_executable(sample10_unittest samples gtest)
endif()
########################################################################
#
# Google Test's own tests.
#
# You can skip this section if you aren't interested in testing
# Google Test itself.
#
# The tests are not built by default. To build them, set the
# gtest_build_tests option to ON. You can do it by running ccmake
# or specifying the -Dgtest_build_tests=ON flag when running cmake.
if (gtest_build_tests)
# This must be set in the root directory for the tests to be run by
# 'make test' or ctest.
enable_testing()
if (WIN32)
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1"
CONTENT
"$project_bin = \"${CMAKE_BINARY_DIR}/bin/$<CONFIG>\"
$env:Path = \"$project_bin;$env:Path\"
& $args")
elseif (MINGW OR CYGWIN)
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1"
CONTENT
"$project_bin = (cygpath --windows ${CMAKE_BINARY_DIR}/bin)
$env:Path = \"$project_bin;$env:Path\"
& $args")
endif()
############################################################
# C++ tests built with standard compiler flags.
cxx_test(googletest-death-test-test gtest_main)
cxx_test(gtest_environment_test gtest)
cxx_test(googletest-filepath-test gtest_main)
cxx_test(googletest-listener-test gtest_main)
cxx_test(gtest_main_unittest gtest_main)
cxx_test(googletest-message-test gtest_main)
cxx_test(gtest_no_test_unittest gtest)
cxx_test(googletest-options-test gtest_main)
cxx_test(googletest-param-test-test gtest
test/googletest-param-test2-test.cc)
cxx_test(googletest-port-test gtest_main)
cxx_test(gtest_pred_impl_unittest gtest_main)
cxx_test(gtest_premature_exit_test gtest
test/gtest_premature_exit_test.cc)
cxx_test(googletest-printers-test gtest_main)
cxx_test(gtest_prod_test gtest_main
test/production.cc)
cxx_test(gtest_repeat_test gtest)
cxx_test(gtest_sole_header_test gtest_main)
cxx_test(gtest_stress_test gtest)
cxx_test(googletest-test-part-test gtest_main)
cxx_test(gtest_throw_on_failure_ex_test gtest)
cxx_test(gtest-typed-test_test gtest_main
test/gtest-typed-test2_test.cc)
cxx_test(gtest_unittest gtest_main)
cxx_test(gtest-unittest-api_test gtest)
cxx_test(gtest_skip_in_environment_setup_test gtest_main)
cxx_test(gtest_skip_test gtest_main)
############################################################
# C++ tests built with non-standard compiler flags.
# MSVC 7.1 does not support STL with exceptions disabled.
if (NOT MSVC OR MSVC_VERSION GREATER 1310)
cxx_library(gtest_no_exception "${cxx_no_exception}"
src/gtest-all.cc)
cxx_library(gtest_main_no_exception "${cxx_no_exception}"
src/gtest-all.cc src/gtest_main.cc)
endif()
cxx_library(gtest_main_no_rtti "${cxx_no_rtti}"
src/gtest-all.cc src/gtest_main.cc)
cxx_test_with_flags(gtest-death-test_ex_nocatch_test
"${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0"
gtest test/googletest-death-test_ex_test.cc)
cxx_test_with_flags(gtest-death-test_ex_catch_test
"${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"
gtest test/googletest-death-test_ex_test.cc)
cxx_test_with_flags(gtest_no_rtti_unittest "${cxx_no_rtti}"
gtest_main_no_rtti test/gtest_unittest.cc)
cxx_shared_library(gtest_dll "${cxx_default}"
src/gtest-all.cc src/gtest_main.cc)
cxx_executable_with_flags(gtest_dll_test_ "${cxx_default}"
gtest_dll test/gtest_all_test.cc)
set_target_properties(gtest_dll_test_
PROPERTIES
COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
############################################################
# Python tests.
cxx_executable(googletest-break-on-failure-unittest_ test gtest)
py_test(googletest-break-on-failure-unittest)
py_test(gtest_skip_check_output_test)
py_test(gtest_skip_environment_check_output_test)
# Visual Studio .NET 2003 does not support STL with exceptions disabled.
if (NOT MSVC OR MSVC_VERSION GREATER 1310) # 1310 is Visual Studio .NET 2003
cxx_executable_with_flags(
googletest-catch-exceptions-no-ex-test_
"${cxx_no_exception}"
gtest_main_no_exception
test/googletest-catch-exceptions-test_.cc)
endif()
cxx_executable_with_flags(
googletest-catch-exceptions-ex-test_
"${cxx_exception}"
gtest_main
test/googletest-catch-exceptions-test_.cc)
py_test(googletest-catch-exceptions-test)
cxx_executable(googletest-color-test_ test gtest)
py_test(googletest-color-test)
cxx_executable(googletest-env-var-test_ test gtest)
py_test(googletest-env-var-test)
cxx_executable(googletest-filter-unittest_ test gtest)
py_test(googletest-filter-unittest)
cxx_executable(gtest_help_test_ test gtest_main)
py_test(gtest_help_test)
cxx_executable(googletest-list-tests-unittest_ test gtest)
py_test(googletest-list-tests-unittest)
cxx_executable(googletest-output-test_ test gtest)
py_test(googletest-output-test --no_stacktrace_support)
cxx_executable(googletest-shuffle-test_ test gtest)
py_test(googletest-shuffle-test)
# MSVC 7.1 does not support STL with exceptions disabled.
if (NOT MSVC OR MSVC_VERSION GREATER 1310)
cxx_executable(googletest-throw-on-failure-test_ test gtest_no_exception)
set_target_properties(googletest-throw-on-failure-test_
PROPERTIES
COMPILE_FLAGS "${cxx_no_exception}")
py_test(googletest-throw-on-failure-test)
endif()
cxx_executable(googletest-uninitialized-test_ test gtest)
py_test(googletest-uninitialized-test)
cxx_executable(gtest_xml_outfile1_test_ test gtest_main)
cxx_executable(gtest_xml_outfile2_test_ test gtest_main)
py_test(gtest_xml_outfiles_test)
py_test(googletest-json-outfiles-test)
cxx_executable(gtest_xml_output_unittest_ test gtest)
py_test(gtest_xml_output_unittest --no_stacktrace_support)
py_test(googletest-json-output-unittest --no_stacktrace_support)
endif()
================================================
FILE: test/googletest/CONTRIBUTORS
================================================
# This file contains a list of people who've made non-trivial
# contribution to the Google C++ Testing Framework project. People
# who commit code to the project are encouraged to add their names
# here. Please keep the list sorted by first names.
Ajay Joshi <jaj@google.com>
Balázs Dán <balazs.dan@gmail.com>
Bharat Mediratta <bharat@menalto.com>
Chandler Carruth <chandlerc@google.com>
Chris Prince <cprince@google.com>
Chris Taylor <taylorc@google.com>
Dan Egnor <egnor@google.com>
Eric Roman <eroman@chromium.org>
Hady Zalek <hady.zalek@gmail.com>
Jeffrey Yasskin <jyasskin@google.com>
Jói Sigurðsson <joi@google.com>
Keir Mierle <mierle@gmail.com>
Keith Ray <keith.ray@gmail.com>
Kenton Varda <kenton@google.com>
Krystian Kuzniarek <krystian.kuzniarek@gmail.com>
Manuel Klimek <klimek@google.com>
Markus Heule <markus.heule@gmail.com>
Mika Raento <mikie@iki.fi>
Miklós Fazekas <mfazekas@szemafor.com>
Pasi Valminen <pasi.valminen@gmail.com>
Patrick Hanna <phanna@google.com>
Patrick Riley <pfr@google.com>
Peter Kaminski <piotrk@google.com>
Preston Jackson <preston.a.jackson@gmail.com>
Rainer Klaffenboeck <rainer.klaffenboeck@dynatrace.com>
Russ Cox <rsc@google.com>
Russ Rufer <russ@pentad.com>
Sean Mcafee <eefacm@gmail.com>
Sigurður Ásgeirsson <siggi@google.com>
Tracy Bialik <tracy@pentad.com>
Vadim Berman <vadimb@google.com>
Vlad Losev <vladl@google.com>
Zhanyong Wan <wan@google.com>
================================================
FILE: test/googletest/LICENSE
================================================
Copyright 2008, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================
FILE: test/googletest/README.md
================================================
### Generic Build Instructions
#### Setup
To build Google Test and your tests that use it, you need to tell your build
system where to find its headers and source files. The exact way to do it
depends on which build system you use, and is usually straightforward.
### Build with CMake
Google Test comes with a CMake build script
([CMakeLists.txt](https://github.com/google/googletest/blob/master/CMakeLists.txt))
that can be used on a wide range of platforms ("C" stands for cross-platform.).
If you don't have CMake installed already, you can download it for free from
<http://www.cmake.org/>.
CMake works by generating native makefiles or build projects that can be used in
the compiler environment of your choice. You can either build Google Test as a
standalone project or it can be incorporated into an existing CMake build for
another project.
#### Standalone CMake Project
When building Google Test as a standalone project, the typical workflow starts
with:
mkdir mybuild # Create a directory to hold the build output.
cd mybuild
cmake ${GTEST_DIR} # Generate native build scripts.
If you want to build Google Test's samples, you should replace the last command
with
cmake -Dgtest_build_samples=ON ${GTEST_DIR}
If you are on a \*nix system, you should now see a Makefile in the current
directory. Just type 'make' to build gtest.
If you use Windows and have Visual Studio installed, a `gtest.sln` file and
several `.vcproj` files will be created. You can then build them using Visual
Studio.
On Mac OS X with Xcode installed, a `.xcodeproj` file will be generated.
#### Incorporating Into An Existing CMake Project
If you want to use gtest in a project which already uses CMake, then a more
robust and flexible approach is to build gtest as part of that project directly.
This is done by making the GoogleTest source code available to the main build
and adding it using CMake's `add_subdirectory()` command. This has the
significant advantage that the same compiler and linker settings are used
between gtest and the rest of your project, so issues associated with using
incompatible libraries (eg debug/release), etc. are avoided. This is
particularly useful on Windows. Making GoogleTest's source code available to the
main build can be done a few different ways:
* Download the GoogleTest source code manually and place it at a known
location. This is the least flexible approach and can make it more difficult
to use with continuous integration systems, etc.
* Embed the GoogleTest source code as a direct copy in the main project's
source tree. This is often the simplest approach, but is also the hardest to
keep up to date. Some organizations may not permit this method.
* Add GoogleTest as a git submodule or equivalent. This may not always be
possible or appropriate. Git submodules, for example, have their own set of
advantages and drawbacks.
* Use CMake to download GoogleTest as part of the build's configure step. This
is just a little more complex, but doesn't have the limitations of the other
methods.
The last of the above methods is implemented with a small piece of CMake code in
a separate file (e.g. `CMakeLists.txt.in`) which is copied to the build area and
then invoked as a sub-build _during the CMake stage_. That directory is then
pulled into the main build with `add_subdirectory()`. For example:
New file `CMakeLists.txt.in`:
```cmake
cmake_minimum_required(VERSION 2.8.2)
project(googletest-download NONE)
include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
```
Existing build's `CMakeLists.txt`:
```cmake
# Download and unpack googletest at configure time
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "Build step for googletest failed: ${result}")
endif()
# Prevent overriding the parent project's compiler/linker
# settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
${CMAKE_CURRENT_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL)
# The gtest/gtest_main targets carry header search path
# dependencies automatically when using CMake 2.8.11 or
# later. Otherwise we have to add them here ourselves.
if (CMAKE_VERSION VERSION_LESS 2.8.11)
include_directories("${gtest_SOURCE_DIR}/include")
endif()
# Now simply link against gtest or gtest_main as needed. Eg
add_executable(example example.cpp)
target_link_libraries(example gtest_main)
add_test(NAME example_test COMMAND example)
```
Note that this approach requires CMake 2.8.2 or later due to its use of the
`ExternalProject_Add()` command. The above technique is discussed in more detail
in [this separate article](http://crascit.com/2015/07/25/cmake-gtest/) which
also contains a link to a fully generalized implementation of the technique.
##### Visual Studio Dynamic vs Static Runtimes
By default, new Visual Studio projects link the C runtimes dynamically but
Google Test links them statically. This will generate an error that looks
something like the following: gtest.lib(gtest-all.obj) : error LNK2038: mismatch
detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value
'MDd_DynamicDebug' in main.obj
Google Test already has a CMake option for this: `gtest_force_shared_crt`
Enabling this option will make gtest link the runtimes dynamically too, and
match the project in which it is included.
#### C++ Standard Version
An environment that supports C++11 is required in order to successfully build
Google Test. One way to ensure this is to specify the standard in the top-level
project, for example by using the `set(CMAKE_CXX_STANDARD 11)` command. If this
is not feasible, for example in a C project using Google Test for validation,
then it can be specified by adding it to the options for cmake via the
`DCMAKE_CXX_FLAGS` option.
### Tweaking Google Test
Google Test can be used in diverse environments. The default configuration may
not work (or may not work well) out of the box in some environments. However,
you can easily tweak Google Test by defining control macros on the compiler
command line. Generally, these macros are named like `GTEST_XYZ` and you define
them to either 1 or 0 to enable or disable a certain feature.
We list the most frequently used macros below. For a complete list, see file
[include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/master/googletest/include/gtest/internal/gtest-port.h).
### Multi-threaded Tests
Google Test is thread-safe where the pthread library is available. After
`#include "gtest/gtest.h"`, you can check the
`GTEST_IS_THREADSAFE` macro to see whether this is the case (yes if the macro is
`#defined` to 1, no if it's undefined.).
If Google Test doesn't correctly detect whether pthread is available in your
environment, you can force it with
-DGTEST_HAS_PTHREAD=1
or
-DGTEST_HAS_PTHREAD=0
When Google Test uses pthread, you may need to add flags to your compiler and/or
linker to select the pthread library, or you'll get link errors. If you use the
CMake script or the deprecated Autotools script, this is taken care of for you.
If you use your own build script, you'll need to read your compiler and linker's
manual to figure out what flags to add.
### As a Shared Library (DLL)
Google Test is compact, so most users can build and link it as a static library
for the simplicity. You can choose to use Google Test as a shared library (known
as a DLL on Windows) if you prefer.
To compile *gtest* as a shared library, add
-DGTEST_CREATE_SHARED_LIBRARY=1
to the compiler flags. You'll also need to tell the linker to produce a shared
library instead - consult your linker's manual for how to do it.
To compile your *tests* that use the gtest shared library, add
-DGTEST_LINKED_AS_SHARED_LIBRARY=1
to the compiler flags.
Note: while the above steps aren't technically necessary today when using some
compilers (e.g. GCC), they may become necessary in the future, if we decide to
improve the speed of loading the library (see
<http://gcc.gnu.org/wiki/Visibility> for details). Therefore you are recommended
to always add the above flags when using Google Test as a shared library.
Otherwise a future release of Google Test may break your build script.
### Avoiding Macro Name Clashes
In C++, macros don't obey namespaces. Therefore two libraries that both define a
macro of the same name will clash if you `#include` both definitions. In case a
Google Test macro clashes with another library, you can force Google Test to
rename its macro to avoid the conflict.
Specifically, if both Google Test and some other code define macro FOO, you can
add
-DGTEST_DONT_DEFINE_FOO=1
to the compiler flags to tell Google Test to change the macro's name from `FOO`
to `GTEST_FOO`. Currently `FOO` can be `FAIL`, `SUCCEED`, or `TEST`. For
example, with `-DGTEST_DONT_DEFINE_TEST=1`, you'll need to write
GTEST_TEST(SomeTest, DoesThis) { ... }
instead of
TEST(SomeTest, DoesThis) { ... }
in order to define a test.
================================================
FILE: test/googletest/cmake/Config.cmake.in
================================================
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
if (@GTEST_HAS_PTHREAD@)
set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@)
find_dependency(Threads)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
check_required_components("@project_name@")
================================================
FILE: test/googletest/cmake/gtest.pc.in
================================================
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: gtest
Description: GoogleTest (without main() function)
Version: @PROJECT_VERSION@
URL: https://github.com/google/googletest
Libs: -L${libdir} -lgtest @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@
================================================
FILE: test/googletest/cmake/gtest_main.pc.in
================================================
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: gtest_main
Description: GoogleTest (with main() function)
Version: @PROJECT_VERSION@
URL: https://github.com/google/googletest
Requires: gtest
Libs: -L${libdir} -lgtest_main @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@
================================================
FILE: test/googletest/cmake/internal_utils.cmake
================================================
# Defines functions and macros useful for building Google Test and
# Google Mock.
#
# Note:
#
# - This file will be run twice when building Google Mock (once via
# Google Test's CMakeLists.txt, and once via Google Mock's).
# Therefore it shouldn't have any side effects other than defining
# the functions and macros.
#
# - The functions/macros defined in this file may depend on Google
# Test and Google Mock's option() definitions, and thus must be
# called *after* the options have been defined.
if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif (POLICY CMP0054)
# Tweaks CMake's default compiler/linker settings to suit Google Test's needs.
#
# This must be a macro(), as inside a function string() can only
# update variables in the function scope.
macro(fix_default_compiler_settings_)
if (MSVC)
# For MSVC, CMake sets certain flags to defaults we want to override.
# This replacement code is taken from sample in the CMake Wiki at
# https://gitlab.kitware.com/cmake/community/wikis/FAQ#dynamic-replace.
foreach (flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt)
# When Google Test is built as a shared library, it should also use
# shared runtime libraries. Otherwise, it may end up with multiple
# copies of runtime library data in different modules, resulting in
# hard-to-find crashes. When it is built as a static library, it is
# preferable to use CRT as static libraries, as we don't have to rely
# on CRT DLLs being available. CMake always defaults to using shared
# CRT libraries, so we override that default here.
string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}")
endif()
# We prefer more strict warning checking for building Google Test.
# Replaces /W3 with /W4 in defaults.
string(REPLACE "/W3" "/W4" ${flag_var} "${${flag_var}}")
# Prevent D9025 warning for targets that have exception handling
# turned off (/EHs-c- flag). Where required, exceptions are explicitly
# re-enabled using the cxx_exception_flags variable.
string(REPLACE "/EHsc" "" ${flag_var} "${${flag_var}}")
endforeach()
endif()
endmacro()
# Defines the compiler/linker flags used to build Google Test and
# Google Mock. You can tweak these definitions to suit your need. A
# variable's value is empty before it's explicitly assigned to.
macro(config_compiler_and_linker)
# Note: pthreads on MinGW is not supported, even if available
# instead, we use windows threading primitives
unset(GTEST_HAS_PTHREAD)
if (NOT gtest_disable_pthreads AND NOT MINGW)
# Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
find_package(Threads)
if (CMAKE_USE_PTHREADS_INIT)
set(GTEST_HAS_PTHREAD ON)
endif()
endif()
fix_default_compiler_settings_()
if (MSVC)
# Newlines inside flags variables break CMake's NMake generator.
# TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds.
set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -J -Zi")
set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32")
set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN")
set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1")
set(cxx_no_exception_flags "-EHs-c- -D_HAS_EXCEPTIONS=0")
set(cxx_no_rtti_flags "-GR-")
# Suppress "unreachable code" warning
# http://stackoverflow.com/questions/3232669 explains the issue.
set(cxx_base_flags "${cxx_base_flags} -wd4702")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(cxx_base_flags "-Wall -Wshadow -Werror -Wconversion")
set(cxx_exception_flags "-fexceptions")
set(cxx_no_exception_flags "-fno-exceptions")
set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls")
set(cxx_no_rtti_flags "-fno-rtti")
elseif (CMAKE_COMPILER_IS_GNUCXX)
set(cxx_base_flags "-Wall -Wshadow -Werror")
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)
set(cxx_base_flags "${cxx_base_flags} -Wno-error=dangling-else")
endif()
set(cxx_exception_flags "-fexceptions")
set(cxx_no_exception_flags "-fno-exceptions")
# Until version 4.3.2, GCC doesn't define a macro to indicate
# whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI
# explicitly.
set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0")
set(cxx_strict_flags
"-Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
set(cxx_exception_flags "-features=except")
# Sun Pro doesn't provide macros to indicate whether exceptions and
# RTTI are enabled, so we define GTEST_HAS_* explicitly.
set(cxx_no_exception_flags "-features=no%except -DGTEST_HAS_EXCEPTIONS=0")
set(cxx_no_rtti_flags "-features=no%rtti -DGTEST_HAS_RTTI=0")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "VisualAge" OR
CMAKE_CXX_COMPILER_ID STREQUAL "XL")
# CMake 2.8 changes Visual Age's compiler ID to "XL".
set(cxx_exception_flags "-qeh")
set(cxx_no_exception_flags "-qnoeh")
# Until version 9.0, Visual Age doesn't define a macro to indicate
# whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI
# explicitly.
set(cxx_no_rtti_flags "-qnortti -DGTEST_HAS_RTTI=0")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "HP")
set(cxx_base_flags "-AA -mt")
set(cxx_exception_flags "-DGTEST_HAS_EXCEPTIONS=1")
set(cxx_no_exception_flags "+noeh -DGTEST_HAS_EXCEPTIONS=0")
# RTTI can not be disabled in HP aCC compiler.
set(cxx_no_rtti_flags "")
endif()
# The pthreads library is available and allowed?
if (DEFINED GTEST_HAS_PTHREAD)
set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=1")
else()
set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=0")
endif()
set(cxx_base_flags "${cxx_base_flags} ${GTEST_HAS_PTHREAD_MACRO}")
# For building gtest's own tests and samples.
set(cxx_exception "${cxx_base_flags} ${cxx_exception_flags}")
set(cxx_no_exception
"${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_no_exception_flags}")
set(cxx_default "${cxx_exception}")
set(cxx_no_rtti "${cxx_default} ${cxx_no_rtti_flags}")
# For building the gtest libraries.
set(cxx_strict "${cxx_default} ${cxx_strict_flags}")
endmacro()
# Defines the gtest & gtest_main libraries. User tests should link
# with one of them.
function(cxx_library_with_type name type cxx_flags)
# type can be either STATIC or SHARED to denote a static or shared library.
# ARGN refers to additional arguments after 'cxx_flags'.
add_library(${name} ${type} ${ARGN})
set_target_properties(${name}
PROPERTIES
COMPILE_FLAGS "${cxx_flags}")
# Generate debug library name with a postfix.
set_target_properties(${name}
PROPERTIES
DEBUG_POSTFIX "d")
# Set the output directory for build artifacts
set_target_properties(${name}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
# make PDBs match library name
get_target_property(pdb_debug_postfix ${name} DEBUG_POSTFIX)
set_target_properties(${name}
PROPERTIES
PDB_NAME "${name}"
PDB_NAME_DEBUG "${name}${pdb_debug_postfix}"
COMPILE_PDB_NAME "${name}"
COMPILE_PDB_NAME_DEBUG "${name}${pdb_debug_postfix}")
if (BUILD_SHARED_LIBS OR type STREQUAL "SHARED")
set_target_properties(${name}
PROPERTIES
COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
if (NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
target_compile_definitions(${name} INTERFACE
$<INSTALL_INTERFACE:GTEST_LINKED_AS_SHARED_LIBRARY=1>)
endif()
endif()
if (DEFINED GTEST_HAS_PTHREAD)
if ("${CMAKE_VERSION}" VERSION_LESS "3.1.0")
set(threads_spec ${CMAKE_THREAD_LIBS_INIT})
else()
set(threads_spec Threads::Threads)
endif()
target_link_libraries(${name} PUBLIC ${threads_spec})
endif()
endfunction()
########################################################################
#
# Helper functions for creating build targets.
function(cxx_shared_library name cxx_flags)
cxx_library_with_type(${name} SHARED "${cxx_flags}" ${ARGN})
endfunction()
function(cxx_library name cxx_flags)
cxx_library_with_type(${name} "" "${cxx_flags}" ${ARGN})
endfunction()
# cxx_executable_with_flags(name cxx_flags libs srcs...)
#
# creates a named C++ executable that depends on the given libraries and
# is built from the given source files with the given compiler flags.
function(cxx_executable_with_flags name cxx_flags libs)
add_executable(${name} ${ARGN})
if (MSVC)
# BigObj required for tests.
set(cxx_flags "${cxx_flags} -bigobj")
endif()
if (cxx_flags)
set_target_properties(${name}
PROPERTIES
COMPILE_FLAGS "${cxx_flags}")
endif()
if (BUILD_SHARED_LIBS)
set_target_properties(${name}
PROPERTIES
COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
endif()
# To support mixing linking in static and dynamic libraries, link each
# library in with an extra call to target_link_libraries.
foreach (lib "${libs}")
target_link_libraries(${name} ${lib})
endforeach()
endfunction()
# cxx_executable(name dir lib srcs...)
#
# creates a named target that depends on the given libs and is built
# from the given source files. dir/name.cc is implicitly included in
# the source file list.
function(cxx_executable name dir libs)
cxx_executable_with_flags(
${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN})
endfunction()
# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE.
find_package(PythonInterp)
# cxx_test_with_flags(name cxx_flags libs srcs...)
#
# creates a named C++ test that depends on the given libs and is built
# from the given source files with the given compiler flags.
function(cxx_test_with_flags name cxx_flags libs)
cxx_executable_with_flags(${name} "${cxx_flags}" "${libs}" ${ARGN})
if (WIN32 OR MINGW)
add_test(NAME ${name}
COMMAND "powershell" "-Command" "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1" "$<TARGET_FILE:${name}>")
else()
add_test(NAME ${name}
COMMAND "$<TARGET_FILE:${name}>")
endif()
endfunction()
# cxx_test(name libs srcs...)
#
# creates a named test target that depends on the given libs and is
# built from the given source files. Unlike cxx_test_with_flags,
# test/name.cc is already implicitly included in the source file list.
function(cxx_test name libs)
cxx_test_with_flags("${name}" "${cxx_default}" "${libs}"
"test/${name}.cc" ${ARGN})
endfunction()
# py_test(name)
#
# creates a Python test with the given name whose main module is in
# test/name.py. It does nothing if Python is not installed.
function(py_test name)
if (PYTHONINTERP_FOUND)
if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 3.1)
if (CMAKE_CONFIGURATION_TYPES)
# Multi-configuration build generators as for Visual Studio save
# output in a subdirectory of CMAKE_CURRENT_BINARY_DIR (Debug,
# Release etc.), so we have to provide it here.
if (WIN32 OR MINGW)
add_test(NAME ${name}
COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG> ${ARGN})
else()
add_test(NAME ${name}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG> ${ARGN})
endif()
else (CMAKE_CONFIGURATION_TYPES)
# Single-configuration build generators like Makefile generators
# don't have subdirs below CMAKE_CURRENT_BINARY_DIR.
if (WIN32 OR MINGW)
add_test(NAME ${name}
COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
--build_dir=${CMAKE_CURRENT_BINARY_DIR} ${ARGN})
else()
add_test(NAME ${name}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
--build_dir=${CMAKE_CURRENT_BINARY_DIR} ${ARGN})
endif()
endif (CMAKE_CONFIGURATION_TYPES)
else()
# ${CMAKE_CURRENT_BINARY_DIR} is known at configuration time, so we can
# directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known
# only at ctest runtime (by calling ctest -c <Configuration>), so
# we have to escape $ to delay variable substitution here.
if (WIN32 OR MINGW)
add_test(NAME ${name}
COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN})
else()
add_test(NAME ${name}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN})
endif()
endif()
endif(PYTHONINTERP_FOUND)
endfunction()
# install_project(targets...)
#
# Installs the specified targets and configures the associated pkgconfig files.
function(install_project)
if(INSTALL_GTEST)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
# Install the project targets.
install(TARGETS ${ARGN}
EXPORT ${targets_export_name}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
# Install PDBs
foreach(t ${ARGN})
get_target_property(t_pdb_name ${t} COMPILE_PDB_NAME)
get_target_property(t_pdb_name_debug ${t} COMPILE_PDB_NAME_DEBUG)
get_target_property(t_pdb_output_directory ${t} PDB_OUTPUT_DIRECTORY)
install(FILES
"${t_pdb_output_directory}/\${CMAKE_INSTALL_CONFIG_NAME}/$<$<CONFIG:Debug>:${t_pdb_name_debug}>$<$<NOT:$<CONFIG:Debug>>:${t_pdb_name}>.pdb"
DESTINATION ${CMAKE_INSTALL_LIBDIR}
OPTIONAL)
endforeach()
endif()
# Configure and install pkgconfig files.
foreach(t ${ARGN})
set(configured_pc "${generated_dir}/${t}.pc")
configure_file("${PROJECT_SOURCE_DIR}/cmake/${t}.pc.in"
"${configured_pc}" @ONLY)
install(FILES "${configured_pc}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endforeach()
endif()
endfunction()
================================================
FILE: test/googletest/cmake/libgtest.la.in
================================================
# libgtest.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4.6
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Names of this library.
library_names='libgtest.so'
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='@CMAKE_INSTALL_FULL_LIBDIR@'
================================================
FILE: test/googletest/docs/advanced.md
================================================
# Advanced googletest Topics
<!-- GOOGLETEST_CM0016 DO NOT DELETE -->
## Introduction
Now that you have read the [googletest Primer](primer.md) and learned how to
write tests using googletest, it's time to learn some new tricks. This document
will show you more assertions as well as how to construct complex failure
messages, propagate fatal failures, reuse and speed up your test fixtures, and
use various flags with your tests.
## More Assertions
This section covers some less frequently used, but still significant,
assertions.
### Explicit Success and Failure
These three assertions do not actually test a value or expression. Instead, they
generate a success or failure directly. Like the macros that actually perform a
test, you may stream a custom failure message into them.
```c++
SUCCEED();
```
Generates a success. This does **NOT** make the overall test succeed. A test is
considered successful only if none of its assertions fail during its execution.
NOTE: `SUCCEED()` is purely documentary and currently doesn't generate any
user-visible output. However, we may add `SUCCEED()` messages to googletest's
output in the future.
```c++
FAIL();
ADD_FAILURE();
ADD_FAILURE_AT("file_path", line_number);
```
`FAIL()` generates a fatal failure, while `ADD_FAILURE()` and `ADD_FAILURE_AT()`
generate a nonfatal failure. These are useful when control flow, rather than a
Boolean expression, determines the test's success or failure. For example, you
might want to write something like:
```c++
switch(expression) {
case 1:
... some checks ...
case 2:
... some other checks ...
default:
FAIL() << "We shouldn't get here.";
}
```
NOTE: you can only use `FAIL()` in functions that return `void`. See the
[Assertion Placement section](#assertion-placement) for more information.
### Exception Assertions
These are for verifying that a piece of code throws (or does not throw) an
exception of the given type:
Fatal assertion | Nonfatal assertion | Verifies
------------------------------------------ | ------------------------------------------ | --------
`ASSERT_THROW(statement, exception_type);` | `EXPECT_THROW(statement, exception_type);` | `statement` throws an exception of the given type
`ASSERT_ANY_THROW(statement);` | `EXPECT_ANY_THROW(statement);` | `statement` throws an exception of any type
`ASSERT_NO_THROW(statement);` | `EXPECT_NO_THROW(statement);` | `statement` doesn't throw any exception
Examples:
```c++
ASSERT_THROW(Foo(5), bar_exception);
EXPECT_NO_THROW({
int n = 5;
Bar(&n);
});
```
**Availability**: requires exceptions to be enabled in the build environment
### Predicate Assertions for Better Error Messages
Even though googletest has a rich set of assertions, they can never be complete,
as it's impossible (nor a good idea) to anticipate all scenarios a user might
run into. Therefore, sometimes a user has to use `EXPECT_TRUE()` to check a
complex expression, for lack of a better macro. This has the problem of not
showing you the values of the parts of the expression, making it hard to
understand what went wrong. As a workaround, some users choose to construct the
failure message by themselves, streaming it into `EXPECT_TRUE()`. However, this
is awkward especially when the expression has side-effects or is expensive to
evaluate.
googletest gives you three different options to solve this problem:
#### Using an Existing Boolean Function
If you already have a function or functor that returns `bool` (or a type that
can be implicitly converted to `bool`), you can use it in a *predicate
assertion* to get the function arguments printed for free:
<!-- mdformat off(github rendering does not support multiline tables) -->
| Fatal assertion | Nonfatal assertion | Verifies |
| --------------------------------- | --------------------------------- | --------------------------- |
| `ASSERT_PRED1(pred1, val1)` | `EXPECT_PRED1(pred1, val1)` | `pred1(val1)` is true |
| `ASSERT_PRED2(pred2, val1, val2)` | `EXPECT_PRED2(pred2, val1, val2)` | `pred1(val1, val2)` is true |
| `...` | `...` | `...` |
<!-- mdformat on-->
In the above, `predn` is an `n`-ary predicate function or functor, where `val1`,
`val2`, ..., and `valn` are its arguments. The assertion succeeds if the
predicate returns `true` when applied to the given arguments, and fails
otherwise. When the assertion fails, it prints the value of each argument. In
either case, the arguments are evaluated exactly once.
Here's an example. Given
```c++
// Returns true if m and n have no common divisors except 1.
bool MutuallyPrime(int m, int n) { ... }
const int a = 3;
const int b = 4;
const int c = 10;
```
the assertion
```c++
EXPECT_PRED2(MutuallyPrime, a, b);
```
will succeed, while the assertion
```c++
EXPECT_PRED2(MutuallyPrime, b, c);
```
will fail with the message
```none
MutuallyPrime(b, c) is false, where
b is 4
c is 10
```
> NOTE:
>
> 1. If you see a compiler error "no matching function to call" when using
> `ASSERT_PRED*` or `EXPECT_PRED*`, please see
> [this](faq.md#the-compiler-complains-no-matching-function-to-call-when-i-use-assert-pred-how-do-i-fix-it)
> for how to resolve it.
#### Using a Function That Returns an AssertionResult
While `EXPECT_PRED*()` and friends are handy for a quick job, the syntax is not
satisfactory: you have to use different macros for different arities, and it
feels more like Lisp than C++. The `::testing::AssertionResult` class solves
this problem.
An `AssertionResult` object represents the result of an assertion (whether it's
a success or a failure, and an associated message). You can create an
`AssertionResult` using one of these factory functions:
```c++
namespace testing {
// Returns an AssertionResult object to indicate that an assertion has
// succeeded.
AssertionResult AssertionSuccess();
// Returns an AssertionResult object to indicate that an assertion has
// failed.
AssertionResult AssertionFailure();
}
```
You can then use the `<<` operator to stream messages to the `AssertionResult`
object.
To provide more readable messages in Boolean assertions (e.g. `EXPECT_TRUE()`),
write a predicate function that returns `AssertionResult` instead of `bool`. For
example, if you define `IsEven()` as:
```c++
::testing::AssertionResult IsEven(int n) {
if ((n % 2) == 0)
return ::testing::AssertionSuccess();
else
return ::testing::AssertionFailure() << n << " is odd";
}
```
instead of:
```c++
bool IsEven(int n) {
return (n % 2) == 0;
}
```
the failed assertion `EXPECT_TRUE(IsEven(Fib(4)))` will print:
```none
Value of: IsEven(Fib(4))
Actual: false (3 is odd)
Expected: true
```
instead of a more opaque
```none
Value of: IsEven(Fib(4))
Actual: false
Expected: true
```
If you want informative messages in `EXPECT_FALSE` and `ASSERT_FALSE` as well
(one third of Boolean assertions in the Google code base are negative ones), and
are fine with making the predicate slower in the success case, you can supply a
success message:
```c++
::testing::AssertionResult IsEven(int n) {
if ((n % 2) == 0)
return ::testing::AssertionSuccess() << n << " is even";
else
return ::testing::AssertionFailure() << n << " is odd";
}
```
Then the statement `EXPECT_FALSE(IsEven(Fib(6)))` will print
```none
Value of: IsEven(Fib(6))
Actual: true (8 is even)
Expected: false
```
#### Using a Predicate-Formatter
If you find the default message generated by `(ASSERT|EXPECT)_PRED*` and
`(ASSERT|EXPECT)_(TRUE|FALSE)` unsatisfactory, or some arguments to your
predicate do not support streaming to `ostream`, you can instead use the
following *predicate-formatter assertions* to *fully* customize how the message
is formatted:
Fatal assertion | Nonfatal assertion | Verifies
------------------------------------------------ | ------------------------------------------------ | --------
`ASSERT_PRED_FORMAT1(pred_format1, val1);` | `EXPECT_PRED_FORMAT1(pred_format1, val1);` | `pred_format1(val1)` is successful
`ASSERT_PRED_FORMAT2(pred_format2, val1, val2);` | `EXPECT_PRED_FORMAT2(pred_format2, val1, val2);` | `pred_format2(val1, val2)` is successful
`...` | `...` | ...
The difference between this and the previous group of macros is that instead of
a predicate, `(ASSERT|EXPECT)_PRED_FORMAT*` take a *predicate-formatter*
(`pred_formatn`), which is a function or functor with the signature:
```c++
::testing::AssertionResult PredicateFormattern(const char* expr1,
const char* expr2,
...
const char* exprn,
T1 val1,
T2 val2,
...
Tn valn);
```
where `val1`, `val2`, ..., and `valn` are the values of the predicate arguments,
and `expr1`, `expr2`, ..., and `exprn` are the corresponding expressions as they
appear in the source code. The types `T1`, `T2`, ..., and `Tn` can be either
value types or reference types. For example, if an argument has type `Foo`, you
can declare it as either `Foo` or `const Foo&`, whichever is appropriate.
As an example, let's improve the failure message in `MutuallyPrime()`, which was
used with `EXPECT_PRED2()`:
```c++
// Returns the smallest prime common divisor of m and n,
// or 1 when m and n are mutually prime.
int SmallestPrimeCommonDivisor(int m, int n) { ... }
// A predicate-formatter for asserting that two integers are mutually prime.
::testing::AssertionResult AssertMutuallyPrime(const char* m_expr,
const char* n_expr,
int m,
int n) {
if (MutuallyPrime(m, n)) return ::testing::AssertionSuccess();
return ::testing::AssertionFailure() << m_expr << " and " << n_expr
<< " (" << m << " and " << n << ") are not mutually prime, "
<< "as they have a common divisor " << SmallestPrimeCommonDivisor(m, n);
}
```
With this predicate-formatter, we can use
```c++
EXPECT_PRED_FORMAT2(AssertMutuallyPrime, b, c);
```
to generate the message
```none
b and c (4 and 10) are not mutually prime, as they have a common divisor 2.
```
As you may have realized, many of the built-in assertions we introduced earlier
are special cases of `(EXPECT|ASSERT)_PRED_FORMAT*`. In fact, most of them are
indeed defined using `(EXPECT|ASSERT)_PRED_FORMAT*`.
### Floating-Point Comparison
Comparing floating-point numbers is tricky. Due to round-off errors, it is very
unlikely that two floating-points will match exactly. Therefore, `ASSERT_EQ` 's
naive comparison usually doesn't work. And since floating-points can have a wide
value range, no single fixed error bound works. It's better to compare by a
fixed relative error bound, except for values close to 0 due to the loss of
precision there.
In general, for floating-point comparison to make sense, the user needs to
carefully choose the error bound. If they don't want or care to, comparing in
terms of Units in the Last Place (ULPs) is a good default, and googletest
provides assertions to do this. Full details about ULPs are quite long; if you
want to learn more, see
[here](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
#### Floating-Point Macros
<!-- mdformat off(github rendering does not support multiline tables) -->
| Fatal assertion | Nonfatal assertion | Verifies |
| ------------------------------- | ------------------------------- | ---------------------------------------- |
| `ASSERT_FLOAT_EQ(val1, val2);` | `EXPECT_FLOAT_EQ(val1, val2);` | the two `float` values are almost equal |
| `ASSERT_DOUBLE_EQ(val1, val2);` | `EXPECT_DOUBLE_EQ(val1, val2);` | the two `double` values are almost equal |
<!-- mdformat on-->
By "almost equal" we mean the values are within 4 ULP's from each other.
The following assertions allow you to choose the acceptable error bound:
<!-- mdformat off(github rendering does not support multiline tables) -->
| Fatal assertion | Nonfatal assertion | Verifies |
| ------------------------------------- | ------------------------------------- | -------------------------------------------------------------------------------- |
| `ASSERT_NEAR(val1, val2, abs_error);` | `EXPECT_NEAR(val1, val2, abs_error);` | the difference between `val1` and `val2` doesn't exceed the given absolute error |
<!-- mdformat on-->
#### Floating-Point Predicate-Format Functions
Some floating-point operations are useful, but not that often used. In order to
avoid an explosion of new macros, we provide them as predicate-format functions
that can be used in predicate assertion macros (e.g. `EXPECT_PRED_FORMAT2`,
etc).
```c++
EXPECT_PRED_FORMAT2(::testing::FloatLE, val1, val2);
EXPECT_PRED_FORMAT2(::testing::DoubleLE, val1, val2);
```
Verifies that `val1` is less than, or almost equal to, `val2`. You can replace
`EXPECT_PRED_FORMAT2` in the above table with `ASSERT_PRED_FORMAT2`.
### Asserting Using gMock Matchers
[gMock](../../googlemock) comes with a library of matchers for validating
arguments passed to mock objects. A gMock *matcher* is basically a predicate
that knows how to describe itself. It can be used in these assertion macros:
<!-- mdformat off(github rendering does not support multiline tables) -->
| Fatal assertion | Nonfatal assertion | Verifies |
| ------------------------------ | ------------------------------ | --------------------- |
| `ASSERT_THAT(value, matcher);` | `EXPECT_THAT(value, matcher);` | value matches matcher |
<!-- mdformat on-->
For example, `StartsWith(prefix)` is a matcher that matches a string starting
with `prefix`, and you can write:
```c++
using ::testing::StartsWith;
...
// Verifies that Foo() returns a string starting with "Hello".
EXPECT_THAT(Foo(), StartsWith("Hello"));
```
Read this
[recipe](../../googlemock/docs/cook_book.md#using-matchers-in-googletest-assertions)
in the gMock Cookbook for more details.
gMock has a rich set of matchers. You can do many things googletest cannot do
alone with them. For a list of matchers gMock provides, read
[this](../../googlemock/docs/cook_book.md##using-matchers). It's easy to write
your [own matchers](../../googlemock/docs/cook_book.md#NewMatchers) too.
gMock is bundled with googletest, so you don't need to add any build dependency
in order to take advantage of this. Just include `"testing/base/public/gmock.h"`
and you're ready to go.
### More String Assertions
(Please read the [previous](#asserting-using-gmock-matchers) section first if
you haven't.)
You can use the gMock
[string matchers](../../googlemock/docs/cheat_sheet.md#string-matchers) with
`EXPECT_THAT()` or `ASSERT_THAT()` to do more string comparison tricks
(sub-string, prefix, suffix, regular expression, and etc). For example,
```c++
using ::testing::HasSubstr;
using ::testing::MatchesRegex;
...
ASSERT_THAT(foo_string, HasSubstr("needle"));
EXPECT_THAT(bar_string, MatchesRegex("\\w*\\d+"));
```
If the string contains a well-formed HTML or XML document, you can check whether
its DOM tree matches an
[XPath expression](http://www.w3.org/TR/xpath/#contents):
```c++
// Currently still in //template/prototemplate/testing:xpath_matcher
#include "template/prototemplate/testing/xpath_matcher.h"
using prototemplate::testing::MatchesXPath;
EXPECT_THAT(html_string, MatchesXPath("//a[text()='click here']"));
```
### Windows HRESULT assertions
These assertions test for `HRESULT` success or failure.
Fatal assertion | Nonfatal assertion | Verifies
-------------------------------------- | -------------------------------------- | --------
`ASSERT_HRESULT_SUCCEEDED(expression)` | `EXPECT_HRESULT_SUCCEEDED(expression)` | `expression` is a success `HRESULT`
`ASSERT_HRESULT_FAILED(expression)` | `EXPECT_HRESULT_FAILED(expression)` | `expression` is a failure `HRESULT`
The generated output contains the human-readable error message associated with
the `HRESULT` code returned by `expression`.
You might use them like this:
```c++
CComPtr<IShellDispatch2> shell;
ASSERT_HRESULT_SUCCEEDED(shell.CoCreateInstance(L"Shell.Application"));
CComVariant empty;
ASSERT_HRESULT_SUCCEEDED(shell->ShellExecute(CComBSTR(url), empty, empty, empty, empty));
```
### Type Assertions
You can call the function
```c++
::testing::StaticAssertTypeEq<T1, T2>();
```
to assert that types `T1` and `T2` are the same. The function does nothing if
the assertion is satisfied. If the types are different, the function call will
fail to compile, the compiler error message will say that
`T1 and T2 are not the same type` and most likely (depending on the compiler)
show you the actual values of `T1` and `T2`. This is mainly useful inside
template code.
**Caveat**: When used inside a member function of a class template or a function
template, `StaticAssertTypeEq<T1, T2>()` is effective only if the function is
instantiated. For example, given:
```c++
template <typename T> class Foo {
public:
void Bar() { ::testing::StaticAssertTypeEq<int, T>(); }
};
```
the code:
```c++
void Test1() { Foo<bool> foo; }
```
will not generate a compiler error, as `Foo<bool>::Bar()` is never actually
instantiated. Instead, you need:
```c++
void Test2() { Foo<bool> foo; foo.Bar(); }
```
to cause a compiler error.
### Assertion Placement
You can use assertions in any C++ function. In particular, it doesn't have to be
a method of the test fixture class. The one constraint is that assertions that
generate a fatal failure (`FAIL*` and `ASSERT_*`) can only be used in
void-returning functions. This is a consequence of Google's not using
exceptions. By placing it in a non-void function you'll get a confusing compile
error like `"error: void value not ignored as it ought to be"` or `"cannot
initialize return object of type 'bool' with an rvalue of type 'void'"` or
`"error: no viable conversion from 'void' to 'string'"`.
If you need to use fatal assertions in a function that returns non-void, one
option is to make the function return the value in an out parameter instead. For
example, you can rewrite `T2 Foo(T1 x)` to `void Foo(T1 x, T2* result)`. You
need to make sure that `*result` contains some sensible value even when the
function returns prematurely. As the function now returns `void`, you can use
any assertion inside of it.
If changing the function's type is not an option, you should just use assertions
that generate non-fatal failures, such as `ADD_FAILURE*` and `EXPECT_*`.
NOTE: Constructors and destructors are not considered void-returning functions,
according to the C++ language specification, and so you may not use fatal
assertions in them; you'll get a compilation error if you try. Instead, either
call `abort` and crash the entire test executable, or put the fatal assertion in
a `SetUp`/`TearDown` function; see
[constructor/destructor vs. `SetUp`/`TearDown`](faq.md#CtorVsSetUp)
WARNING: A fatal assertion in a helper function (private void-returning method)
called from a constructor or destructor does not does not terminate the current
test, as your intuition might suggest: it merely returns from the constructor or
destructor early, possibly leaving your object in a partially-constructed or
partially-destructed state! You almost certainly want to `abort` or use
`SetUp`/`TearDown` instead.
## Teaching googletest How to Print Your Values
When a test assertion such as `EXPECT_EQ` fails, googletest prints the argument
values to help you debug. It does this using a user-extensible value printer.
This printer knows how to print built-in C++ types, native arrays, STL
containers, and any type that supports the `<<` operator. For other types, it
prints the raw bytes in the value and hopes that you the user can figure it out.
As mentioned earlier, the printer is *extensible*. That means you can teach it
to do a better job at printing your particular type than to dump the bytes. To
do that, define `<<` for your type:
```c++
#include <ostream>
namespace foo {
class Bar { // We want googletest to be able to print instances of this.
...
// Create a free inline friend function.
friend std::ostream& operator<<(std::ostream& os, const Bar& bar) {
return os << bar.DebugString(); // whatever needed to print bar to os
}
};
// If you can't declare the function in the class it's important that the
// << operator is defined in the SAME namespace that defines Bar. C++'s look-up
// rules rely on that.
std::ostream& operator<<(std::ostream& os, const Bar& bar) {
return os << bar.DebugString(); // whatever needed to print bar to os
}
} // namespace foo
```
Sometimes, this might not be an option: your team may consider it bad style to
have a `<<` operator for `Bar`, or `Bar` may already have a `<<` operator that
doesn't do what you want (and you cannot change it). If so, you can instead
define a `PrintTo()` function like this:
```c++
#include <ostream>
namespace foo {
class Bar {
...
friend void PrintTo(const Bar& bar, std::ostream* os) {
*os << bar.DebugString(); // whatever needed to print bar to os
}
};
// If you can't declare the function in the class it's important that PrintTo()
// is defined in the SAME namespace that defines Bar. C++'s look-up rules rely
// on that.
void PrintTo(const Bar& bar, std::ostream* os) {
*os << bar.DebugString(); // whatever needed to print bar to os
}
} // namespace foo
```
If you have defined both `<<` and `PrintTo()`, the latter will be used when
googletest is concerned. This allows you to customize how the value appears in
googletest's output without affecting code that relies on the behavior of its
`<<` operator.
If you want to print a value `x` using googletest's value printer yourself, just
call `::testing::PrintToString(x)`, which returns an `std::string`:
```c++
vector<pair<Bar, int> > bar_ints = GetBarIntVector();
EXPECT_TRUE(IsCorrectBarIntVector(bar_ints))
<< "bar_ints = " << ::testing::PrintToString(bar_ints);
```
## Death Tests
In many applications, there are assertions that can cause application failure if
a condition is not met. These sanity checks, which ensure that the program is in
a known good state, are there to fail at the earliest possible time after some
program state is corrupted. If the assertion checks the wrong condition, then
the program may proceed in an erroneous state, which could lead to memory
corruption, security holes, or worse. Hence it is vitally important to test that
such assertion statements work as expected.
Since these precondition checks cause the processes to die, we call such tests
_death tests_. More generally, any test that checks that a program terminates
(except by throwing an exception) in an expected fashion is also a death test.
Note that if a piece of code throws an exception, we don't consider it "death"
for the purpose of death tests, as the caller of the code could catch the
exception and avoid the crash. If you want to verify exceptions thrown by your
code, see [Exception Assertions](#ExceptionAssertions).
If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see
Catching Failures
### How to Write a Death Test
googletest has the following macros to support death tests:
Fatal assertion | Nonfatal assertion | Verifies
------------------------------------------------ | ------------------------------------------------ | --------
`ASSERT_DEATH(statement, matcher);` | `EXPECT_DEATH(statement, matcher);` | `statement` crashes with the given error
`ASSERT_DEATH_IF_SUPPORTED(statement, matcher);` | `EXPECT_DEATH_IF_SUPPORTED(statement, matcher);` | if death tests are supported, verifies that `statement` crashes with the given error; otherwise verifies nothing
`ASSERT_EXIT(statement, predicate, matcher);` | `EXPECT_EXIT(statement, predicate, matcher);` | `statement` exits with the given error, and its exit code matches `predicate`
where `statement` is a statement that is expected to cause the process to die,
`predicate` is a function or function object that evaluates an integer exit
status, and `matcher` is either a gMock matcher matching a `const std::string&`
or a (Perl) regular expression - either of which is matched against the stderr
output of `statement`. For legacy reasons, a bare string (i.e. with no matcher)
is interpreted as `ContainsRegex(str)`, **not** `Eq(str)`. Note that `statement`
can be *any valid statement* (including *compound statement*) and doesn't have
to be an expression.
As usual, the `ASSERT` variants abort the current test function, while the
`EXPECT` variants do not.
> NOTE: We use the word "crash" here to mean that the process terminates with a
> *non-zero* exit status code. There are two possibilities: either the process
> has called `exit()` or `_exit()` with a non-zero value, or it may be killed by
> a signal.
>
> This means that if *`statement`* terminates the process with a 0 exit code, it
> is *not* considered a crash by `EXPECT_DEATH`. Use `EXPECT_EXIT` instead if
> this is the case, or if you want to restrict the exit code more precisely.
A predicate here must accept an `int` and return a `bool`. The death test
succeeds only if the predicate returns `true`. googletest defines a few
predicates that handle the most common cases:
```c++
::testing::ExitedWithCode(exit_code)
```
This expression is `true` if the program exited normally with the given exit
code.
```c++
::testing::KilledBySignal(signal_number) // Not available on Windows.
```
This expression is `true` if the program was killed by the given signal.
The `*_DEATH` macros are convenient wrappers for `*_EXIT` that use a predicate
that verifies the process' exit code is non-zero.
Note that a death test only cares about three things:
1. does `statement` abort or exit the process?
2. (in the case of `ASSERT_EXIT` and `EXPECT_EXIT`) does the exit status
satisfy `predicate`? Or (in the case of `ASSERT_DEATH` and `EXPECT_DEATH`)
is the exit status non-zero? And
3. does the stderr output match `matcher`?
In particular, if `statement` generates an `ASSERT_*` or `EXPECT_*` failure, it
will **not** cause the death test to fail, as googletest assertions don't abort
the process.
To write a death test, simply use one of the above macros inside your test
function. For example,
```c++
TEST(MyDeathTest, Foo) {
// This death test uses a compound statement.
ASSERT_DEATH({
int n = 5;
Foo(&n);
}, "Error on line .* of Foo()");
}
TEST(MyDeathTest, NormalExit) {
EXPECT_EXIT(NormalExit(), ::testing::ExitedWithCode(0), "Success");
}
TEST(MyDeathTest, KillMyself) {
EXPECT_EXIT(KillMyself(), ::testing::KilledBySignal(SIGKILL),
"Sending myself unblockable signal");
}
```
verifies that:
* calling `Foo(5)` causes the process to die with the given error message,
* calling `NormalExit()` causes the process to print `"Success"` to stderr and
exit with exit code 0, and
* calling `KillMyself()` kills the process with signal `SIGKILL`.
The test function body may contain other assertions and statements as well, if
necessary.
### Death Test Naming
IMPORTANT: We strongly recommend you to follow the convention of naming your
**test suite** (not test) `*DeathTest` when it contains a death test, as
demonstrated in the above example. The
[Death Tests And Threads](#death-tests-and-threads) section below explains why.
If a test fixture class is shared by normal tests and death tests, you can use
`using` or `typedef` to introduce an alias for the fixture class and avoid
duplicating its code:
```c++
class FooTest : public ::testing::Test { ... };
using FooDeathTest = FooTest;
TEST_F(FooTest, DoesThis) {
// normal test
}
TEST_F(FooDeathTest, DoesThat) {
// death test
}
```
### Regular Expression Syntax
On POSIX systems (e.g. Linux, Cygwin, and Mac), googletest uses the
[POSIX extended regular expression](http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04)
syntax. To learn about this syntax, you may want to read this
[Wikipedia entry](http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions).
On Windows, googletest uses its own simple regular expression implementation. It
lacks many features. For example, we don't support union (`"x|y"`), grouping
(`"(xy)"`), brackets (`"[xy]"`), and repetition count (`"x{5,7}"`), among
others. Below is what we do support (`A` denotes a literal character, period
(`.`), or a single `\\ ` escape sequence; `x` and `y` denote regular
expressions.):
Expression | Meaning
---------- | --------------------------------------------------------------
`c` | matches any literal character `c`
`\\d` | matches any decimal digit
`\\D` | matches any character that's not a decimal digit
`\\f` | matches `\f`
`\\n` | matches `\n`
`\\r` | matches `\r`
`\\s` | matches any ASCII whitespace, including `\n`
`\\S` | matches any character that's not a whitespace
`\\t` | matches `\t`
`\\v` | matches `\v`
`\\w` | matches any letter, `_`, or decimal digit
`\\W` | matches any character that `\\w` doesn't match
`\\c` | matches any literal character `c`, which must be a punctuation
`.` | matches any single character except `\n`
`A?` | matches 0 or 1 occurrences of `A`
`A*` | matches 0 or many occurrences of `A`
`A+` | matches 1 or many occurrences of `A`
`^` | matches the beginning of a string (not that of each line)
`$` | matches the end of a string (not that of each line)
`xy` | matches `x` followed by `y`
To help you determine which capability is available on your system, googletest
defines macros to govern which regular expression it is using. The macros are:
`GTEST_USES_SIMPLE_RE=1` or `GTEST_USES_POSIX_RE=1`. If you want your death
tests to work in all cases, you can either `#if` on these macros or use the more
limited syntax only.
### How It Works
Under the hood, `ASSERT_EXIT()` spawns a new process and executes the death test
statement in that process. The details of how precisely that happens depend on
the platform and the variable ::testing::GTEST_FLAG(death_test_style) (which is
initialized from the command-line flag `--gtest_death_test_style`).
* On POSIX systems, `fork()` (or `clone()` on Linux) is used to spawn the
child, after which:
* If the variable's value is `"fast"`, the death test statement is
immediately executed.
* If the variable's value is `"threadsafe"`, the child process re-executes
the unit test binary just as it was originally invoked, but with some
extra flags to cause just the single death test under consideration to
be run.
* On Windows, the child is spawned using the `CreateProcess()` API, and
re-executes the binary to cause just the single death test under
consideration to be run - much like the `threadsafe` mode on POSIX.
Other values for the variable are illegal and will cause the death test to fail.
Currently, the flag's default value is **"fast"**
1. the child's exit status satisfies the predicate, and
2. the child's stderr matches the regular expression.
If the death test statement runs to completion without dying, the child process
will nonetheless terminate, and the assertion fails.
### Death Tests And Threads
The reason for the two death test styles has to do with thread safety. Due to
well-known problems with forking in the presence of threads, death tests should
be run in a single-threaded context. Sometimes, however, it isn't feasible to
arrange that kind of environment. For example, statically-initialized modules
may start threads before main is ever reached. Once threads have been created,
it may be difficult or impossible to clean them up.
googletest has three features intended to raise awareness of threading issues.
1. A warning is emitted if multiple threads are running when a death test is
encountered.
2. Test suites with a name ending in "DeathTest" are run before all other
tests.
3. It uses `clone()` instead of `fork()` to spawn the child process on Linux
(`clone()` is not available on Cygwin and Mac), as `fork()` is more likely
to cause the child to hang when the parent process has multiple threads.
It's perfectly fine to create threads inside a death test statement; they are
executed in a separate process and cannot affect the parent.
### Death Test Styles
The "threadsafe" death test style was introduced in order to help mitigate the
risks of testing in a possibly multithreaded environment. It trades increased
test execution time (potentially dramatically so) for improved thread safety.
The automated testing framework does not set the style flag. You can choose a
particular style of death tests by setting the flag programmatically:
```c++
testing::FLAGS_gtest_death_test_style="threadsafe"
```
You can do this in `main()` to set the style for all death tests in the binary,
or in individual tests. Recall that flags are saved before running each test and
restored afterwards, so you need not do that yourself. For example:
```c++
int main(int argc, char** argv) {
InitGoogle(argv[0], &argc, &argv, true);
::testing::FLAGS_gtest_death_test_style = "fast";
return RUN_ALL_TESTS();
}
TEST(MyDeathTest, TestOne) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";
// This test is run in the "threadsafe" style:
ASSERT_DEATH(ThisShouldDie(), "");
}
TEST(MyDeathTest, TestTwo) {
// This test is run in the "fast" style:
ASSERT_DEATH(ThisShouldDie(), "");
}
```
### Caveats
The `statement` argument of `ASSERT_EXIT()` can be any valid C++ statement. If
it leaves the current function via a `return` statement or by throwing an
exception, the death test is considered to have failed. Some googletest macros
may return from the current function (e.g. `ASSERT_TRUE()`), so be sure to avoid
them in `statement`.
Since `statement` runs in the child process, any in-memory side effect (e.g.
modifying a variable, releasing memory, etc) it causes will *not* be observable
in the parent process. In particular, if you release memory in a death test,
your program will fail the heap check as the parent process will never see the
memory reclaimed. To solve this problem, you can
1. try not to free memory in a death test;
2. free the memory again in the parent process; or
3. do not use the heap checker in your program.
Due to an implementation detail, you cannot place multiple death test assertions
on the same line; otherwise, compilation will fail with an unobvious error
message.
Despite the improved thread safety afforded by the "threadsafe" style of death
test, thread problems such as deadlock are still possible in the presence of
handlers registered with `pthread_atfork(3)`.
## Using Assertions in Sub-routines
### Adding Traces to Assertions
If a test sub-routine is called from several places, when an assertion inside it
fails, it can be hard to tell which invocation of the sub-routine the failure is
from. You can alleviate this problem using extra logging or custom failure
messages, but that usually clutters up your tests. A better solution is to use
the `SCOPED_TRACE` macro or the `ScopedTrace` utility:
```c++
SCOPED_TRACE(message);
```
```c++
ScopedTrace trace("file_path", line_number, message);
```
where `message` can be anything streamable to `std::ostream`. `SCOPED_TRACE`
macro will cause the current file name, line number, and the given message to be
added in every failure message. `ScopedTrace` accepts explicit file name and
line number in arguments, which is useful for writing test helpers. The effect
will be undone when the control leaves the current lexical scope.
For example,
```c++
10: void Sub1(int n) {
11: EXPECT_EQ(Bar(n), 1);
12: EXPECT_EQ(Bar(n + 1), 2);
13: }
14:
15: TEST(FooTest, Bar) {
16: {
17: SCOPED_TRACE("A"); // This trace point will be included in
18: // every failure in this scope.
19: Sub1(1);
20: }
21: // Now it won't.
22: Sub1(9);
23: }
```
could result in messages like these:
```none
path/to/foo_test.cc:11: Failure
Value of: Bar(n)
Expected: 1
Actual: 2
Trace:
path/to/foo_test.cc:17: A
path/to/foo_test.cc:12: Failure
Value of: Bar(n + 1)
Expected: 2
Actual: 3
```
Without the trace, it would've been difficult to know which invocation of
`Sub1()` the two failures come from respectively. (You could add an extra
message to each assertion in `Sub1()` to indicate the value of `n`, but that's
tedious.)
Some tips on using `SCOPED_TRACE`:
1. With a suitable message, it's often enough to use `SCOPED_TRACE` at the
beginning of a sub-routine, instead of at each call site.
2. When calling sub-routines inside a loop, make the loop iterator part of the
message in `SCOPED_TRACE` such that you can know which iteration the failure
is from.
3. Sometimes the line number of the trace point is enough for identifying the
particular invocation of a sub-routine. In this case, you don't have to
choose a unique message for `SCOPED_TRACE`. You can simply use `""`.
4. You can use `SCOPED_TRACE` in an inner scope when there is one in the outer
scope. In this case, all active trace points will be included in the failure
messages, in reverse order they are encountered.
5. The trace dump is clickable in Emacs - hit `return` on a line number and
you'll be taken to that line in the source file!
### Propagating Fatal Failures
A common pitfall when using `ASSERT_*` and `FAIL*` is not understanding that
when they fail they only abort the _current function_, not the entire test. For
example, the following test will segfault:
```c++
void Subroutine() {
// Generates a fatal failure and aborts the current function.
ASSERT_EQ(1, 2);
// The following won't be executed.
...
}
TEST(FooTest, Bar) {
Subroutine(); // The intended behavior is for the fatal failure
// in Subroutine() to abort the entire test.
// The actual behavior: the function goes on after Subroutine() returns.
int* p = NULL;
*p = 3; // Segfault!
}
```
To alleviate this, googletest provides three different solutions. You could use
either exceptions, the `(ASSERT|EXPECT)_NO_FATAL_FAILURE` assertions or the
`HasFatalFailure()` function. They are described in the following two
subsections.
#### Asserting on Subroutines with an exception
The following code can turn ASSERT-failure into an exception:
```c++
class ThrowListener : public testing::EmptyTestEventListener {
void OnTestPartResult(const testing::TestPartResult& result) override {
if (result.type() == testing::TestPartResult::kFatalFailure) {
throw testing::AssertionException(result);
}
}
};
int main(int argc, char** argv) {
...
testing::UnitTest::GetInstance()->listeners().Append(new ThrowListener);
return RUN_ALL_TESTS();
}
```
This listener should be added after other listeners if you have any, otherwise
they won't see failed `OnTestPartResult`.
#### Asserting on Subroutines
As shown above, if your test calls a subroutine that has an `ASSERT_*` failure
in it, the test will continue after the subroutine returns. This may not be what
you want.
Often people want fatal failures to propagate like exceptions. For that
googletest offers the following macros:
Fatal assertion | Nonfatal assertion | Verifies
------------------------------------- | ------------------------------------- | --------
`ASSERT_NO_FATAL_FAILURE(statement);` | `EXPECT_NO_FATAL_FAILURE(statement);` | `statement` doesn't generate any new fatal failures in the current thread.
Only failures in the thread that executes the assertion are checked to determine
the result of this type of assertions. If `statement` creates new threads,
failures in these threads are ignored.
Examples:
```c++
ASSERT_NO_FATAL_FAILURE(Foo());
int i;
EXPECT_NO_FATAL_FAILURE({
i = Bar();
});
```
Assertions from multiple threads are currently not supported on Windows.
#### Checking for Failures in the Current Test
`HasFatalFailure()` in the `::testing::Test` class returns `true` if an
assertion in the current test has suffered a fatal failure. This allows
functions to catch fatal failures in a sub-routine and return early.
```c++
class Test {
public:
...
static bool HasFatalFailure();
};
```
The typical usage, which basically simulates the behavior of a thrown exception,
is:
```c++
TEST(FooTest, Bar) {
Subroutine();
// Aborts if Subroutine() had a fatal failure.
if (HasFatalFailure()) return;
// The following won't be executed.
...
}
```
If `HasFatalFailure()` is used outside of `TEST()` , `TEST_F()` , or a test
fixture, you must add the `::testing::Test::` prefix, as in:
```c++
if (::testing::Test::HasFatalFailure()) return;
```
Similarly, `HasNonfatalFailure()` returns `true` if the current test has at
least one non-fatal failure, and `HasFailure()` returns `true` if the current
test has at least one failure of either kind.
## Logging Additional Information
In your test code, you can call `RecordProperty("key", value)` to log additional
information, where `value` can be either a string or an `int`. The *last* value
recorded for a key will be emitted to the
[XML output](#generating-an-xml-report) if you specify one. For example, the
test
```c++
TEST_F(WidgetUsageTest, MinAndMaxWidgets) {
RecordProperty("MaximumWidgets", ComputeMaxUsage());
RecordProperty("MinimumWidgets", ComputeMinUsage());
}
```
will output XML like this:
```xml
...
<testcase name="MinAndMaxWidgets" status="run" time="0.006" classname="WidgetUsageTest" MaximumWidgets="12" MinimumWidgets="9" />
...
```
> NOTE:
>
> * `RecordProperty()` is a static member of the `Test` class. Therefore it
> needs to be prefixed with `::testing::Test::` if used outside of the
> `TEST` body and the test fixture class.
> * *`key`* must be a valid XML attribute name, and cannot conflict with the
> ones already used by googletest (`name`, `status`, `time`, `classname`,
> `type_param`, and `value_param`).
> * Calling `RecordProperty()` outside of the lifespan of a test is allowed.
> If it's called outside of a test but between a test suite's
> `SetUpTestSuite()` and `TearDownTestSuite()` methods, it will be
> attributed to the XML element for the test suite. If it's called outside
> of all test suites (e.g. in a test environment), it will be attributed to
> the top-level XML element.
## Sharing Resources Between Tests in the Same Test Suite
googletest creates a new test fixture object for each test in order to make
tests independent and easier to debug. However, sometimes tests use resources
that are expensive to set up, making the one-copy-per-test model prohibitively
expensive.
If the tests don't change the resource, there's no harm in their sharing a
single resource copy. So, in addition to per-test set-up/tear-down, googletest
also supports per-test-suite set-up/tear-down. To use it:
1. In your test fixture class (say `FooTest` ), declare as `static` some member
variables to hold the shared resources.
2. Outside your test fixture class (typically just below it), define those
member variables, optionally giving them initial values.
3. In the same test fixture class, define a `static void SetUpTestSuite()`
function (remember not to spell it as **`SetupTestSuite`** with a small
`u`!) to set up the shared resources and a `static void TearDownTestSuite()`
function to tear them down.
That's it! googletest automatically calls `SetUpTestSuite()` before running the
*first test* in the `FooTest` test suite (i.e. before creating the first
`FooTest` object), and calls `TearDownTestSuite()` after running the *last test*
in it (i.e. after deleting the last `FooTest` object). In between, the tests can
use the shared resources.
Remember that the test order is undefined, so your code can't depend on a test
preceding or following another. Also, the tests must either not modify the state
of any shared resource, or, if they do modify the state, they must restore the
state to its original value before passing control to the next test.
Here's an example of per-test-suite set-up and tear-down:
```c++
class FooTest : public ::testing::Test {
protected:
// Per-test-suite set-up.
// Called before the first test in this test suite.
// Can be omitted if not needed.
static void SetUpTestSuite() {
shared_resource_ = new ...;
}
// Per-test-suite tear-down.
// Called after the last test in this test suite.
// Can be omitted if not needed.
static void TearDownTestSuite() {
delete shared_resource_;
shared_resource_ = NULL;
}
// You can define per-test set-up logic as usual.
virtual void SetUp() { ... }
// You can define per-test tear-down logic as usual.
virtual void TearDown() { ... }
// Some expensive resource shared by all tests.
static T* shared_resource_;
};
T* FooTest::shared_resource_ = NULL;
TEST_F(FooTest, Test1) {
... you can refer to shared_resource_ here ...
}
TEST_F(FooTest, Test2) {
... you can refer to shared_resource_ here ...
}
```
NOTE: Though the above code declares `SetUpTestSuite()` protected, it may
sometimes be necessary to declare it public, such as when using it with
`TEST_P`.
## Global Set-Up and Tear-Down
Just as you can do set-up and tear-down at the test level and the test suite
level, you can also do it at the test program level. Here's how.
First, you subclass the `::testing::Environment` class to define a test
environment, which knows how to set-up and tear-down:
```c++
class Environment : public ::testing::Environment {
public:
virtual ~Environment() {}
// Override this to define how to set up the environment.
void SetUp() override {}
// Override this to define how to tear down the environment.
void TearDown() override {}
};
```
Then, you register an instance of your environment class with googletest by
calling the `::testing::AddGlobalTestEnvironment()` function:
```c++
Environment* AddGlobalTestEnvironment(Environment* env);
```
Now, when `RUN_ALL_TESTS()` is called, it first calls the `SetUp()` method of
each environment object, then runs the tests if none of the environments
reported fatal failures and `GTEST_SKIP()` was not called. `RUN_ALL_TESTS()`
always calls `TearDown()` with each environment object, regardless of whether or
not the tests were run.
It's OK to register multiple environment objects. In this suite, their `SetUp()`
will be called in the order they are registered, and their `TearDown()` will be
called in the reverse order.
Note that googletest takes ownership of the registered environment objects.
Therefore **do not delete them** by yourself.
You should call `AddGlobalTestEnvironment()` before `RUN_ALL_TESTS()` is called,
probably in `main()`. If you use `gtest_main`, you need to call this before
`main()` starts for it to take effect. One way to do this is to define a global
variable like this:
```c++
::testing::Environment* const foo_env =
::testing::AddGlobalTestEnvironment(new FooEnvironment);
```
However, we strongly recommend you to write your own `main()` and call
`AddGlobalTestEnvironment()` there, as relying on initialization of global
variables makes the code harder to read and may cause problems when you register
multiple environments from different translation units and the environments have
dependencies among them (remember that the compiler doesn't guarantee the order
in which global variables from different translation units are initialized).
## Value-Parameterized Tests
*Value-parameterized tests* allow you to test your code with different
parameters without writing multiple copies of the same test. This is useful in a
number of situations, for example:
* You have a piece of code whose behavior is affected by one or more
command-line flags. You want to make sure your code performs correctly for
various values of those flags.
* You want to test different implementations of an OO interface.
* You want to test your code over various inputs (a.k.a. data-driven testing).
This feature is easy to abuse, so please exercise your good sense when doing
it!
### How to Write Value-Parameterized Tests
To write value-parameterized tests, first you should define a fixture class. It
must be derived from both `testing::Test` and `testing::WithParamInterface<T>`
(the latter is a pure interface), where `T` is the type of your parameter
values. For convenience, you can just derive the fixture class from
`testing::TestWithParam<T>`, which itself is derived from both `testing::Test`
and `testing::WithParamInterface<T>`. `T` can be any copyable type. If it's a
raw pointer, you are responsible for managing the lifespan of the pointed
values.
NOTE: If your test fixture defines `SetUpTestSuite()` or `TearDownTestSuite()`
they must be declared **public** rather than **protected** in order to use
`TEST_P`.
```c++
class FooTest :
public testing::TestWithParam<const char*> {
// You can implement all the usual fixture class members here.
// To access the test parameter, call GetParam() from class
// TestWithParam<T>.
};
// Or, when you want to add parameters to a pre-existing fixture class:
class BaseTest : public testing::Test {
...
};
class BarTest : public BaseTest,
public testing::WithParamInterface<const char*> {
...
};
```
Then, use the `TEST_P` macro to define as many test patterns using this fixture
as you want. The `_P` suffix is for "parameterized" or "pattern", whichever you
prefer to think.
```c++
TEST_P(FooTest, DoesBlah) {
// Inside a test, access the test parameter with the GetParam() method
// of the TestWithParam<T> class:
EXPECT_TRUE(foo.Blah(GetParam()));
...
}
TEST_P(FooTest, HasBlahBlah) {
...
}
```
Finally, you can use `INSTANTIATE_TEST_SUITE_P` to instantiate the test suite
with any set of parameters you want. googletest defines a number of functions
for generating test parameters. They return what we call (surprise!) *parameter
generators*. Here is a summary of them, which are all in the `testing`
namespace:
<!-- mdformat off(github rendering does not support multiline tables) -->
| Parameter Generator | Behavior |
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `Range(begin, end [, step])` | Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. |
| `Values(v1, v2, ..., vN)` | Yields values `{v1, v2, ..., vN}`. |
| `ValuesIn(container)` and `ValuesIn(begin,end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)` |
| `Bool()` | Yields sequence `{false, true}`. |
| `Combine(g1, g2, ..., gN)` | Yields all combinations (Cartesian product) as std\:\:tuples of the values generated by the `N` generators. |
<!-- mdformat on-->
For more details, see the comments at the definitions of these functions.
The following statement will instantiate tests from the `FooTest` test suite
each with parameter values `"meeny"`, `"miny"`, and `"moe"`.
```c++
INSTANTIATE_TEST_SUITE_P(InstantiationName,
FooTest,
testing::Values("meeny", "miny", "moe"));
```
NOTE: The code above must be placed at global or namespace scope, not at
function scope.
NOTE: Don't forget this step! If you do your test will silently pass, but none
of its suites will ever run!
To distinguish different instances of the pattern (yes, you can instantiate it
more than once), the first argument to `INSTANTIATE_TEST_SUITE_P` is a prefix
that will be added to the actual test suite name. Remember to pick unique
prefixes for different instantiations. The tests from the instantiation above
will have these names:
* `InstantiationName/FooTest.DoesBlah/0` for `"meeny"`
* `InstantiationName/FooTest.DoesBlah/1` for `"miny"`
* `InstantiationName/FooTest.DoesBlah/2` for `"moe"`
* `InstantiationName/FooTest.HasBlahBlah/0` for `"meeny"`
* `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"`
* `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"`
You can use these names in [`--gtest_filter`](#running-a-subset-of-the-tests).
This statement will instantiate all tests from `FooTest` again, each with
parameter values `"cat"` and `"dog"`:
```c++
const char* pets[] = {"cat", "dog"};
INSTANTIATE_TEST_SUITE_P(AnotherInstantiationName, FooTest,
testing::ValuesIn(pets));
```
The tests from the instantiation above will have these names:
* `AnotherInstantiationName/FooTest.DoesBlah/0` for `"cat"`
* `AnotherInstantiationName/FooTest.DoesBlah/1` for `"dog"`
* `AnotherInstantiationName/FooTest.HasBlahBlah/0` for `"cat"`
* `AnotherInstantiationName/FooTest.HasBlahBlah/1` for `"dog"`
Please note that `INSTANTIATE_TEST_SUITE_P` will instantiate *all* tests in the
given test suite, whether their definitions come before or *after* the
`INSTANTIATE_TEST_SUITE_P` statement.
You can see [sample7_unittest.cc] and [sample8_unittest.cc] for more examples.
[sample7_unittest.cc]: ../samples/sample7_unittest.cc "Parameterized Test example"
[sample8_unittest.cc]: ../samples/sample8_unittest.cc "Parameterized Test example with multiple parameters"
### Creating Value-Parameterized Abstract Tests
In the above, we define and instantiate `FooTest` in the *same* source file.
Sometimes you may want to define value-parameterized tests in a library and let
other people instantiate them later. This pattern is known as *abstract tests*.
As an example of its application, when you are designing an interface you can
write a standard suite of abstract tests (perhaps using a factory function as
the test parameter) that all implementations of the interface are expected to
pass. When someone implements the interface, they can instantiate your suite to
get all the interface-conformance tests for free.
To define abstract tests, you should organize your code like this:
1. Put the definition of the parameterized test fixture class (e.g. `FooTest`)
in a header file, say `foo_param_test.h`. Think of this as *declaring* your
abstract tests.
2. Put the `TEST_P` definitions in `foo_param_test.cc`, which includes
`foo_param_test.h`. Think of this as *implementing* your abstract tests.
Once they are defined, you can instantiate them by including `foo_param_test.h`,
invoking `INSTANTIATE_TEST_SUITE_P()`, and depending on the library target that
contains `foo_param_test.cc`. You can instantiate the same abstract test suite
multiple times, possibly in different source files.
### Specifying Names for Value-Parameterized Test Parameters
The optional last argument to `INSTANTIATE_TEST_SUITE_P()` allows the user to
specify a function or functor that generates custom test name suffixes based on
the test parameters. The function should accept one argument of type
`testing::TestParamInfo<class ParamType>`, and return `std::string`.
`testing::PrintToStringParamName` is a builtin test suffix generator that
returns the value of `testing::PrintToString(GetParam())`. It does not work for
`std::string` or C strings.
NOTE: test names must be non-empty, unique, and may only contain ASCII
alphanumeric characters. In particular, they
[should not contain underscores](faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore)
```c++
class MyTestSuite : public testing::TestWithParam<int> {};
TEST_P(MyTestSuite, MyTest)
{
std::cout << "Example Test Param: " << GetParam() << std::endl;
}
INSTANTIATE_TEST_SUITE_P(MyGroup, MyTestSuite, testing::Range(0, 10),
testing::PrintToStringParamName());
```
Providing a custom functor allows for more control over test parameter name
generation, especially for types where the automatic conversion does not
generate helpful parameter names (e.g. strings as demonstrated above). The
following example illustrates this for multiple parameters, an enumeration type
and a string, and also demonstrates how to combine generators. It uses a lambda
for conciseness:
```c++
enum class MyType { MY_FOO = 0, MY_BAR = 1 };
class MyTestSuite : public testing::TestWithParam<std::tuple<MyType, string>> {
};
INSTANTIATE_TEST_SUITE_P(
MyGroup, MyTestSuite,
testing::Combine(
testing::Values(MyType::VALUE_0, MyType::VALUE_1),
testing::ValuesIn("", "")),
[](const testing::TestParamInfo<MyTestSuite::ParamType>& info) {
string name = absl::StrCat(
std::get<0>(info.param) == MY_FOO ? "Foo" : "Bar", "_",
std::get<1>(info.param));
absl::c_replace_if(name, [](char c) { return !std::isalnum(c); }, '_');
return name;
});
```
## Typed Tests
Suppose you have multiple implementations of the same interface and want to make
sure that all of them satisfy some common requirements. Or, you may have defined
several types that are supposed to conform to the same "concept" and you want to
verify it. In both cases, you want the same test logic repeated for different
types.
While you can write one `TEST` or `TEST_F` for each type you want to test (and
you may even factor the test logic into a function template that you invoke from
the `TEST`), it's tedious and doesn't scale: if you want `m` tests over `n`
types, you'll end up writing `m*n` `TEST`s.
*Typed tests* allow you to repeat the same test logic over a list of types. You
only need to write the test logic once, although you must know the type list
when writing typed tests. Here's how you do it:
First, define a fixture class template. It should be parameterized by a type.
Remember to derive it from `::testing::Test`:
```c++
template <typename T>
class FooTest : public ::testing::Test {
public:
...
typedef std::list<T> List;
static T shared_;
T value_;
};
```
Next, associate a list of types with the test suite, which will be repeated for
each type in the list:
```c++
using MyTypes = ::testing::Types<char, int, unsigned int>;
TYPED_TEST_SUITE(FooTest, MyTypes);
```
The type alias (`using` or `typedef`) is necessary for the `TYPED_TEST_SUITE`
macro to parse correctly. Otherwise the compiler will think that each comma in
the type list introduces a new macro argument.
Then, use `TYPED_TEST()` instead of `TEST_F()` to define a typed test for this
test suite. You can repeat this as many times as you want:
```c++
TYPED_TEST(FooTest, DoesBlah) {
// Inside a test, refer to the special name TypeParam to get the type
// parameter. Since we are inside a derived class template, C++ requires
// us to visit the members of FooTest via 'this'.
TypeParam n = this->value_;
// To visit static members of the fixture, add the 'TestFixture::'
// prefix.
n += TestFixture::shared_;
// To refer to typedefs in the fixture, add the 'typename TestFixture::'
// prefix. The 'typename' is required to satisfy the compiler.
typename TestFixture::List values;
values.push_back(n);
...
}
TYPED_TEST(FooTest, HasPropertyA) { ... }
```
You can see [sample6_unittest.cc] for a complete example.
[sample6_unittest.cc]: ../samples/sample6_unittest.cc "Typed Test example"
## Type-Parameterized Tests
*Type-parameterized tests* are like typed tests, except that they don't require
you to know the list of types ahead of time. Instead, you can define the test
logic first and instantiate it with different type lists later. You can even
instantiate it more than once in the same program.
If you are designing an interface or concept, you can define a suite of
type-parameterized tests to verify properties that any valid implementation of
the interface/concept should have. Then, the author of each implementation can
just instantiate the test suite with their type to verify that it conforms to
the requirements, without having to write similar tests repeatedly. Here's an
example:
First, define a fixture class template, as we did with typed tests:
```c++
template <typename T>
class FooTest : public ::testing::Test {
...
};
```
Next, declare that you will define a type-parameterized test suite:
```c++
TYPED_TEST_SUITE_P(FooTest);
```
Then, use `TYPED_TEST_P()` to define a type-parameterized test. You can repeat
this as many times as you want:
```c++
TYPED_TEST_P(FooTest, DoesBlah) {
// Inside a test, refer to TypeParam to get the type parameter.
TypeParam n = 0;
...
}
TYPED_TEST_P(FooTest, HasPropertyA) { ... }
```
Now the tricky part: you need to register all test patterns using the
`REGISTER_TYPED_TEST_SUITE_P` macro before you can instantiate them. The first
argument of the macro is the test suite name; the rest are the names of the
tests in this test suite:
```c++
REGISTER_TYPED_TEST_SUITE_P(FooTest,
DoesBlah, HasPropertyA);
```
Finally, you are free to instantiate the pattern with the types you want. If you
put the above code in a header file, you can `#include` it in multiple C++
source files and instantiate it multiple times.
```c++
typedef ::testing::Types<char, int, unsigned int> MyTypes;
INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
```
To distinguish different instances of the pattern, the first argument to the
`INSTANTIATE_TYPED_TEST_SUITE_P` macro is a prefix that will be added to the
actual test suite name. Remember to pick unique prefixes for different
instances.
In the special case where the type list contains only one type, you can write
that type directly without `::testing::Types<...>`, like this:
```c++
INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, int);
```
You can see [sample6_unittest.cc] for a complete example.
## Testing Private Code
If you change your software's internal implementation, your tests should not
break as long as the change is not observable by users. Therefore, **per the
black-box testing principle, most of the time you should test your code through
its public interfaces.**
**If you still find yourself needing to test internal implementation code,
consider if there's a better design.** The desire to test internal
implementation is often a sign that the class is doing too much. Consider
extracting an implementation class, and testing it. Then use that implementation
class in the original class.
If you absolutely have to test non-public interface code though, you can. There
are two cases to consider:
* Static functions ( *not* the same as static member functions!) or unnamed
namespaces, and
* Private or protected class members
To test them, we use the following special techniques:
* Both static functions and definitions/declarations in an unnamed namespace
are only visible within the same translation unit. To test them, you can
`#include` the entire `.cc` file being tested in your `*_test.cc` file.
(#including `.cc` files is not a good way to reuse code - you should not do
this in production code!)
However, a better approach is to move the private code into the
`foo::internal` namespace, where `foo` is the namespace your project
normally uses, and put the private declarations in a `*-internal.h` file.
Your production `.cc` files and your tests are allowed to include this
internal header, but your clients are not. This way, you can fully test your
internal implementation without leaking it to your clients.
* Private class members are only accessible from within the class or by
friends. To access a class' private members, you can declare your test
fixture as a friend to the class and define accessors in your fixture. Tests
using the fixture can then access the private members of your production
class via the accessors in the fixture. Note that even though your fixture
is a friend to your production class, your tests are not automatically
friends to it, as they are technically defined in sub-classes of the
fixture.
Another way to test private members is to refactor them into an
implementation class, which is then declared in a `*-internal.h` file. Your
clients aren't allowed to include this header but your tests can. Such is
called the
[Pimpl](https://www.gamedev.net/articles/programming/general-and-gameplay-programming/the-c-pimpl-r1794/)
(Private Implementation) idiom.
Or, you can declare an individual test as a friend of your class by adding
this line in the class body:
```c++
FRIEND_TEST(TestSuiteName, TestName);
```
For example,
```c++
// foo.h
class Foo {
...
private:
FRIEND_TEST(FooTest, BarReturnsZeroOnNull);
int Bar(void* x);
};
// foo_test.cc
...
TEST(FooTest, BarReturnsZeroOnNull) {
Foo foo;
EXPECT_EQ(foo.Bar(NULL), 0); // Uses Foo's private member Bar().
}
```
Pay special attention when your class is defined in a namespace, as you
should define your test fixtures and tests in the same namespace if you want
them to be friends of your class. For example, if the code to be tested
looks like:
```c++
namespace my_namespace {
class Foo {
friend class FooTest;
FRIEND_TEST(FooTest, Bar);
FRIEND_TEST(FooTest, Baz);
... definition of the class Foo ...
};
} // namespace my_namespace
```
Your test code should be something like:
```c++
namespace my_namespace {
class FooTest : public ::testing::Test {
protected:
...
};
TEST_F(FooTest, Bar) { ... }
TEST_F(FooTest, Baz) { ... }
} // namespace my_namespace
```
## "Catching" Failures
If you are building a testing utility on top of googletest, you'll want to test
your utility. What framework would you use to test it? googletest, of course.
The challenge is to verify that your testing utility reports failures correctly.
In frameworks that report a failure by throwing an exception, you could catch
the exception and assert on it. But googletest doesn't use exceptions, so how do
we test that a piece of code generates an expected failure?
gunit-spi.h contains some constructs to do this. After #including this header,
you can use
```c++
EXPECT_FATAL_FAILURE(statement, substring);
```
to assert that `statement` generates a fatal (e.g. `ASSERT_*`) failure in the
current thread whose message contains the given `substring`, or use
```c++
EXPECT_NONFATAL_FAILURE(statement, substring);
```
if you are expecting a non-fatal (e.g. `EXPECT_*`) failure.
Only failures in the current thread are checked to determine the result of this
type of expectations. If `statement` creates new threads, failures in these
threads are also ignored. If you want to catch failures in other threads as
well, use one of the following macros instead:
```c++
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substring);
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substring);
```
NOTE: Assertions from multiple threads are currently not supported on Windows.
For technical reasons, there are some caveats:
1. You cannot stream a failure message to either macro.
2. `statement` in `EXPECT_FATAL_FAILURE{_ON_ALL_THREADS}()` cannot reference
local non-static variables or non-static members of `this` object.
3. `statement` in `EXPECT_FATAL_FAILURE{_ON_ALL_THREADS}()` cannot return a
value.
## Registering tests programmatically
The `TEST` macros handle the vast majority of all use cases, but there are few
where runtime registration logic is required. For those cases, the framework
provides the `::testing::RegisterTest` that allows callers to register arbitrary
tests dynamically.
This is an advanced API only to be used when the `TEST` macros are insufficient.
The macros should be preferred when possible, as they avoid most of the
complexity of calling this function.
It provides the following signature:
```c++
template <typename Factory>
TestInfo* RegisterTest(const char* test_suite_name, const char* test_name,
const char* type_param, const char* value_param,
const char* file, int line, Factory factory);
```
The `factory` argument is a factory callable (move-constructible) object or
function pointer that creates a new instance of the Test object. It handles
ownership to the caller. The signature of the callable is `Fixture*()`, where
`Fixture` is the test fixture class for the test. All tests registered with the
same `test_suite_name` must return the same fixture type. This is checked at
runtime.
The framework will infer the fixture class from the factory and will call the
`SetUpTestSuite` and `TearDownTestSuite` for it.
Must be called before `RUN_ALL_TESTS()` is invoked, otherwise behavior is
undefined.
Use case example:
```c++
class MyFixture : public ::testing::Test {
public:
// All of these optional, just like in regular macro usage.
static void SetUpTestSuite() { ... }
static void TearDownTestSuite() { ... }
void SetUp() override { ... }
void TearDown() override { ... }
};
class MyTest : public MyFixture {
public:
explicit MyTest(int data) : data_(data) {}
void TestBody() override { ... }
private:
int data_;
};
void RegisterMyTests(const std::vector<int>& values) {
for (int v : values) {
::testing::RegisterTest(
"MyFixture", ("Test" + std::to_string(v)).c_str(), nullptr,
std::to_string(v).c_str(),
__FILE__, __LINE__,
// Important to use the fixture type as the return type here.
[=]() -> MyFixture* { return new MyTest(v); });
}
}
...
int main(int argc, char** argv) {
std::vector<int> values_to_test = LoadValuesFromConfig();
RegisterMyTests(values_to_test);
...
return RUN_ALL_TESTS();
}
```
## Getting the Current Test's Name
Sometimes a function may need to know the name of the currently running test.
For example, you may be using the `SetUp()` method of your test fixture to set
the golden file name based on which test is running. The `::testing::TestInfo`
class has this information:
```c++
namespace testing {
class TestInfo {
public:
// Returns the test suite name and the test name, respectively.
//
// Do NOT delete or free the return value - it's managed by the
// TestInfo class.
const char* test_suite_name() const;
const char* name() const;
};
}
```
To obtain a `TestInfo` object for the currently running test, call
`current_test_info()` on the `UnitTest` singleton object:
```c++
// Gets information about the currently running test.
// Do NOT delete the returned object - it's managed by the UnitTest class.
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
printf("We are in test %s of test suite %s.\n",
test_info->name(),
test_info->test_suite_name());
```
`current_test_info()` returns a null pointer if no test is running. In
particular, you cannot find the test suite name in `TestSuiteSetUp()`,
`TestSuiteTearDown()` (where you know the test suite name implicitly), or
functions called from them.
## Extending googletest by Handling Test Events
googletest provides an **event listener API** to let you receive notifications
about the progress of a test program and test failures. The events you can
listen to include the start and end of the test program, a test suite, or a test
method, among others. You may use this API to augment or replace the standard
console output, replace the XML output, or provide a completely different form
of output, such as a GUI or a database. You can also use test events as
checkpoints to implement a resource leak checker, for example.
### Defining Event Listeners
To define a event listener, you subclass either testing::TestEventListener or
testing::EmptyTestEventListener The former is an (abstract) interface, where
*each pure virtual method can be overridden to handle a test event* (For
example, when a test starts, the `OnTestStart()` method will be called.). The
latter provides an empty implementation of all methods in the interface, such
that a subclass only needs to override the methods it cares about.
When an event is fired, its context is passed to the handler function as an
argument. The following argument types are used:
* UnitTest reflects the state of the entire test program,
* TestSuite has information about a test suite, which can contain one or more
tests,
* TestInfo contains the state of a test, and
* TestPartResult represents the result of a test assertion.
An event handler function can examine the argument it receives to find out
interesting information about the event and the test program's state.
Here's an example:
```c++
class MinimalistPrinter : public ::testing::EmptyTestEventListener {
// Called before a test starts.
virtual void OnTestStart(const ::testing::TestInfo& test_info) {
printf("*** Test %s.%s starting.\n",
test_info.test_suite_name(), test_info.name());
}
// Called after a failed assertion or a SUCCESS().
virtual void OnTestPartResult(const ::testing::TestPartResult& test_part_result) {
printf("%s in %s:%d\n%s\n",
test_part_result.failed() ? "*** Failure" : "Success",
test_part_result.file_name(),
test_part_result.line_number(),
test_part_result.summary());
}
// Called after a test ends.
virtual void OnTestEnd(const ::testing::TestInfo& test_info) {
printf("*** Test %s.%s ending.\n",
test_info.test_suite_name(), test_info.name());
}
};
```
### Using Event Listeners
To use the event listener you have defined, add an instance of it to the
googletest event listener list (represented by class TestEventListeners - note
the "s" at the end of the name) in your `main()` function, before calling
`RUN_ALL_TESTS()`:
```c++
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
// Gets hold of the event listener list.
::testing::TestEventListeners& listeners =
::testing::UnitTest::GetInstance()->listeners();
// Adds a listener to the end. googletest takes the ownership.
listeners.Append(new MinimalistPrinter);
return RUN_ALL_TESTS();
}
```
There's only one problem: the default test result printer is still in effect, so
its output will mingle with the output from your minimalist printer. To suppress
the default printer, just release it from the event listener list and delete it.
You can do so by adding one line:
```c++
...
delete listeners.Release(listeners.default_result_printer());
listeners.Append(new MinimalistPrinter);
return RUN_ALL_TESTS();
```
Now, sit back and enjoy a completely different output from your tests. For more
details, see [sample9_unittest.cc].
[sample9_unittest.cc]: ../samples/sample9_unittest.cc "Event listener example"
You may append more than one listener to the list. When an `On*Start()` or
`OnTestPartResult()` event is fired, the listeners will receive it in the order
they appear in the list (since new listeners are added to the end of the list,
the default text printer and the default XML generator will receive the event
first). An `On*End()` event will be received by the listeners in the *reverse*
order. This allows output by listeners added later to be framed by output from
listeners added earlier.
### Generating Failures in Listeners
You may use failure-raising macros (`EXPECT_*()`, `ASSERT_*()`, `FAIL()`, etc)
when processing an event. There are some restrictions:
1. You cannot generate any failure in `OnTestPartResult()` (otherwise it will
cause `OnTestPartResult()` to be called recursively).
2. A listener that handles `OnTestPartResult()` is not allowed to generate any
failure.
When you add listeners to the listener list, you should put listeners that
handle `OnTestPartResult()` *before* listeners that can generate failures. This
ensures that failures generated by the latter are attributed to the right test
by the former.
See [sample10_unittest.cc] for an example of a failure-raising listener.
[sample10_unittest.cc]: ../samples/sample10_unittest.cc "Failure-raising listener example"
## Running Test Programs: Advanced Options
googletest test programs are ordinary executables. Once built, you can run them
directly and affect their behavior via the following environment variables
and/or command line flags. For the flags to work, your programs must call
`::testing::InitGoogleTest()` before calling `RUN_ALL_TESTS()`.
To see a list of supported flags and their usage, please run your test program
with the `--help` flag. You can also use `-h`, `-?`, or `/?` for short.
If an option is specified both by an environment variable and by a flag, the
latter takes precedence.
### Selecting Tests
#### Listing Test Names
Sometimes it is necessary to list the available tests in a program before
running them so that a filter may be applied if needed. Including the flag
`--gtest_list_tests` overrides all other flags and lists tests in the following
format:
```none
TestSuite1.
TestName1
TestName2
TestSuite2.
TestName
```
None of the tests listed are actually run if the flag is provided. There is no
corresponding environment variable for this flag.
#### Running a Subset of the Tests
By default, a googletest program runs all tests the user has defined. Sometimes,
you want to run only a subset of the tests (e.g. for debugging or quickly
verifying a change). If you set the `GTEST_FILTER` environment variable or the
`--gtest_filter` flag to a filter string, googletest will only run the tests
whose full names (in the form of `TestSuiteName.TestName`) match the filter.
The format of a filter is a '`:`'-separated list of wildcard patterns (called
the *positive patterns*) optionally followed by a '`-`' and another
'`:`'-separated pattern list (called the *negative patterns*). A test matches
the filter if and only if it matches any of the positive patterns but does not
match any of the negative patterns.
A pattern may contain `'*'` (matches any string) or `'?'` (matches any single
character). For convenience, the filter `'*-NegativePatterns'` can be also
written as `'-NegativePatterns'`.
For example:
* `./foo_test` Has no flag, and thus runs all its tests.
* `./foo_test --gtest_filter=*` Also runs everything, due to the single
match-everything `*` value.
* `./foo_test --gtest_filter=FooTest.*` Runs everything in test suite
`FooTest` .
* `./foo_test --gtest_filter=*Null*:*Constructor*` Runs any test whose full
name contains either `"Null"` or `"Constructor"` .
* `./foo_test --gtest_filter=-*DeathTest.*` Runs all non-death tests.
* `./foo_test --gtest_filter=FooTest.*-FooTest.Bar` Runs everything in test
suite `FooTest` except `FooTest.Bar`.
* `./foo_test --gtest_filter=FooTest.*:BarTest.*-FooTest.Bar:BarTest.Foo` Runs
everything in test suite `FooTest` except `FooTest.Bar` and everything in
test suite `BarTest` except `BarTest.Foo`.
#### Temporarily Disabling Tests
If you have a broken test that you cannot fix right away, you can add the
`DISABLED_` prefix to its name. This will exclude it from execution. This is
better than commenting out the code or using `#if 0`, as disabled tests are
still compiled (and thus won't rot).
If you need to disable all tests in a test suite, you can either add `DISABLED_`
to the front of the name of each test, or alternatively add it to the front of
the test suite name.
For example, the following tests won't be run by googletest, even though they
will still be compiled:
```c++
// Tests that Foo does Abc.
TEST(FooTest, DISABLED_DoesAbc) { ... }
class DISABLED_BarTest : public ::testing::Test { ... };
// Tests that Bar does Xyz.
TEST_F(DISABLED_BarTest, DoesXyz) { ... }
```
NOTE: This feature should only be used for temporary pain-relief. You still have
to fix the disabled tests at a later date. As a reminder, googletest will print
a banner warning you if a test program contains any disabled tests.
TIP: You can easily count the number of disabled tests you have using `gsearch`
and/or `grep`. This number can be used as a metric for improving your test
quality.
#### Temporarily Enabling Disabled Tests
To include disabled tests in test execution, just invoke the test program with
the `--gtest_also_run_disabled_tests` flag or set the
`GTEST_ALSO_RUN_DISABLED_TESTS` environment variable to a value other than `0`.
You can combine this with the `--gtest_filter` flag to further select which
disabled tests to run.
### Repeating the Tests
Once in a while you'll run into a test whose result is hit-or-miss. Perhaps it
will fail only 1% of the time, making it rather hard to reproduce the bug under
a debugger. This can be a major source of frustration.
The `--gtest_repeat` flag allows you to repeat all (or selected) test methods in
a program many times. Hopefully, a flaky test will eventually fail and give you
a chance to debug. Here's how to use it:
```none
$ foo_test --gtest_repeat=1000
Repeat foo_test 1000 times and don't stop at failures.
$ foo_test --gtest_repeat=-1
A negative count means repeating forever.
$ foo_test --gtest_repeat=1000 --gtest_break_on_failure
Repeat foo_test 1000 times, stopping at the first failure. This
is especially useful when running under a debugger: when the test
fails, it will drop into the debugger and you can then inspect
variables and stacks.
$ foo_test --gtest_repeat=1000 --gtest_filter=FooBar.*
Repeat the tests whose name matches the filter 1000 times.
```
If your test program contains
[global set-up/tear-down](#global-set-up-and-tear-down) code, it will be
repeated in each iteration as well, as the flakiness may be in it. You can also
specify the repeat count by setting the `GTEST_REPEAT` environment variable.
### Shuffling the Tests
You can specify the `--gtest_shuffle` flag (or set the `GTEST_SHUFFLE`
environment variable to `1`) to run the tests in a program in a random order.
This helps to reveal bad dependencies between tests.
By default, googletest uses a random seed calculated from the current time.
Therefore you'll get a different order every time. The console output includes
the random seed value, such that you can reproduce an order-related test failure
later. To specify the random seed explicitly, use the `--gtest_random_seed=SEED`
flag (or set the `GTEST_RANDOM_SEED` environment variable), where `SEED` is an
integer in the range [0, 99999]. The seed value 0 is special: it tells
googletest to do the default behavior of calculating the seed from the current
time.
If you combine this with `--gtest_repeat=N`, googletest will pick a different
random seed and re-shuffle the tests in each iteration.
### Controlling Test Output
#### Colored Terminal Output
googletest can use colors in its terminal output to make it easier to spot the
important information:
<code>
...<br/>
<font color="green">[----------]</font><font color="black"> 1 test from
FooTest</font><br/>
<font color="green">[ RUN ]</font><font color="black">
FooTest.DoesAbc</font><br/>
<font color="green">[ OK ]</font><font color="black">
FooTest.DoesAbc </font><br/>
<font color="green">[----------]</font><font color="black">
2 tests from BarTest</font><br/>
<font color="green">[ RUN ]</font><font color="black">
BarTest.HasXyzProperty </font><br/>
<font color="green">[ OK ]</font><font color="black">
BarTest.HasXyzProperty</font><br/>
<font color="green">[ RUN ]</font><font color="black">
BarTest.ReturnsTrueOnSuccess ... some error messages ...</font><br/>
<font color="red">[ FAILED ]</font><font color="black">
BarTest.ReturnsTrueOnSuccess ...</font><br/>
<font color="green">[==========]</font><font color="black">
30 tests from 14 test suites ran.</font><br/>
<font color="green">[ PASSED ]</font><font color="black">
28 tests.</font><br/>
<font color="red">[ FAILED ]</font><font color="black">
2 tests, listed below:</font><br/>
<font color="red">[ FAILED ]</font><font color="black">
BarTest.ReturnsTrueOnSuccess</font><br/>
<font color="red">[ FAILED ]</font><font color="black">
AnotherTest.DoesXyz<br/>
<br/>
2 FAILED TESTS
</font>
</code>
You can set the `GTEST_COLOR` environment variable or the `--gtest_color`
command line flag to `yes`, `no`, or `auto` (the default) to enable colors,
disable colors, or let googletest decide. When the value is `auto`, googletest
will use colors if and only if the output goes to a terminal and (on non-Windows
platforms) the `TERM` environment variable is set to `xterm` or `xterm-color`.
#### Suppressing the Elapsed Time
By default, googletest prints the time it takes to run each test. To disable
that, run the test program with the `--gtest_print_time=0` command line flag, or
set the GTEST_PRINT_TIME environment variable to `0`.
#### Suppressing UTF-8 Text Output
In case of assertion failures, googletest prints expected and actual values of
type `string` both as hex-encoded strings as well as in readable UTF-8 text if
they contain valid non-ASCII UTF-8 characters. If you want to suppress the UTF-8
text because, for example, you don't have an UTF-8 compatible output medium, run
the test program with `--gtest_print_utf8=0` or set the `GTEST_PRINT_UTF8`
environment variable to `0`.
#### Generating an XML Report
googletest can emit a detailed XML report to a file in addition to its normal
textual output. The report contains the duration of each test, and thus can help
you identify slow tests. The report is also used by the http://unittest
dashboard to show per-test-method error messages.
To generate the XML report, set the `GTEST_OUTPUT` environment variable or the
`--gtest_output` flag to the string `"xml:path_to_output_file"`, which will
create the file at the given location. You can also just use the string `"xml"`,
in which case the output can be found in the `test_detail.xml` file in the
current directory.
If you specify a directory (for example, `"xml:output/directory/"` on Linux or
`"xml:output\directory\"` on Windows), googletest will create the XML file in
that directory, named after the test executable (e.g. `foo_test.xml` for test
program `foo_test` or `foo_test.exe`). If the file already exists (perhaps left
over from a previous run), googletest will pick a different name (e.g.
`foo_test_1.xml`) to avoid overwriting it.
The report is based on the `junitreport` Ant task. Since that format was
originally intended for Java, a little interpretation is required to make it
apply to googletest tests, as shown here:
```xml
<testsuites name="AllTests" ...>
<testsuite name="test_case_name" ...>
<testcase name="test_name" ...>
<failure message="..."/>
<failure message="..."/>
<failure message="..."/>
</testcase>
</testsuite>
</testsuites>
```
* The root `<testsuites>` element corresponds to the entire test program.
* `<testsuite>` elements correspond to googletest test suites.
* `<testcase>` elements correspond to googletest test functions.
For instance, the following program
```c++
TEST(MathTest, Addition) { ... }
TEST(MathTest, Subtraction) { ... }
TEST(LogicTest, NonContradiction) { ... }
```
could generate this report:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="1" errors="0" time="0.035" timestamp="2011-10-31T18:52:42" name="AllTests">
<testsuite name="MathTest" tests="2" failures="1" errors="0" time="0.015">
<testcase name="Addition" status="run" time="0.007" classname="">
<failure message="Value of: add(1, 1)
 Actual: 3
Expected: 2" type="">...</failure>
<failure message="Value of: add(1, -1)
 Actual: 1
Expected: 0" type="">...</failure>
</testcase>
<testcase name="Subtraction" status="run" time="0.005" classname="">
</testcase>
</testsuite>
<testsuite name="LogicTest" tests="1" failures="0" errors="0" time="0.005">
<testcase name="NonContradiction" status="run" time="0.005" classname="">
</testcase>
</testsuite>
</testsuites>
```
Things to note:
* The `tests` attribute of a `<testsuites>` or `<testsuite>` element tells how
many test functions the googletest program or test suite contains, while the
`failures` attribute tells how many of them failed.
* The `time` attribute expresses the duration of the test, test suite, or
entire test program in seconds.
* The `timestamp` attribute records the local date and time of the test
execution.
* Each `<failure>` element corresponds to a single failed googletest
assertion.
#### Generating a JSON Report
googletest can also emit a JSON report as an alternative format to XML. To
generate the JSON report, set the `GTEST_OUTPUT` environment variable or the
`--gtest_output` flag to the string `"json:path_to_output_file"`, which will
create the file at the given location. You can also just use the string
`"json"`, in which case the output can be found in the `test_detail.json` file
in the current directory.
The report format conforms to the following JSON Schema:
```json
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"definitions": {
"TestCase": {
"type": "object",
"properties": {
"name": { "type": "string" },
"tests": { "type": "integer" },
"failures": { "type": "integer" },
"disabled": { "type": "integer" },
"time": { "type": "string" },
"testsuite": {
"type": "array",
"items": {
"$ref": "#/definitions/TestInfo"
}
}
}
},
"TestInfo": {
"type": "object",
"properties": {
"name": { "type": "string" },
"status": {
"type": "string",
"enum": ["RUN", "NOTRUN"]
},
"time": { "type": "string" },
"classname": { "type": "string" },
"failures": {
"type": "array",
"items": {
"$ref": "#/definitions/Failure"
}
}
}
},
"Failure": {
"type": "object",
"properties": {
"failures": { "type": "string" },
"type": { "type": "string" }
}
}
},
"properties": {
"tests": { "type": "integer" },
"failures": { "type": "integer" },
"disabled": { "type": "integer" },
"errors": { "type": "integer" },
"timestamp": {
"type": "string",
"format": "date-time"
},
"time": { "type": "string" },
"name": { "type": "string" },
"testsuites": {
"type": "array",
"items": {
"$ref": "#/definitions/TestCase"
}
}
}
}
```
The report uses the format that conforms to the following Proto3 using the
[JSON encoding](https://developers.google.com/protocol-buffers/docs/proto3#json):
```proto
syntax = "proto3";
package googletest;
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";
message UnitTest {
int32 tests = 1;
int32 failures = 2;
int32 disabled = 3;
int32 errors = 4;
google.protobuf.Timestamp timestamp = 5;
google.protobuf.Duration time = 6;
string name = 7;
repeated TestCase testsuites = 8;
}
message TestCase {
string name = 1;
int32 tests = 2;
int32 failures = 3;
int32 disabled = 4;
int32 errors = 5;
google.protobuf.Duration time = 6;
repeated TestInfo testsuite = 7;
}
message TestInfo {
string name = 1;
enum Status {
RUN = 0;
NOTRUN = 1;
}
Status status = 2;
google.protobuf.Duration time = 3;
string classname = 4;
message Failure {
string failures = 1;
string type = 2;
}
repeated Failure failures = 5;
}
```
For instance, the following program
```c++
TEST(MathTest, Addition) { ... }
TEST(MathTest, Subtraction) { ... }
TEST(LogicTest, NonContradiction) { ... }
```
could generate this report:
```json
{
"tests": 3,
"failures": 1,
"errors": 0,
"time": "0.035s",
"timestamp": "2011-10-31T18:52:42Z",
"name": "AllTests",
"testsuites": [
{
"name": "MathTest",
"tests": 2,
"failures": 1,
"errors": 0,
"time": "0.015s",
"testsuite": [
{
"name": "Addition",
"status": "RUN",
"time": "0.007s",
"classname": "",
"failures": [
{
"message": "Value of: add(1, 1)\n Actual: 3\nExpected: 2",
"type": ""
},
{
"message": "Value of: add(1, -1)\n Actual: 1\nExpected: 0",
"type": ""
}
]
},
{
"name": "Subtraction",
"status": "RUN",
"time": "0.005s",
"classname": ""
}
]
},
{
"name": "LogicTest",
"tests": 1,
"failures": 0,
"errors": 0,
"time": "0.005s",
"testsuite": [
{
"name": "NonContradiction",
"status": "RUN",
"time": "0.005s",
"classname": ""
}
]
}
]
}
```
IMPORTANT: The exact format of the JSON document is subject to change.
### Controlling How Failures Are Reported
#### Turning Assertion Failures into Break-Points
When running test programs under a debugger, it's very convenient if the
debugger can catch an assertion failure and automatically drop into interactive
mode. googletest's *break-on-failure* mode supports this behavior.
To enable it, set the `GTEST_BREAK_ON_FAILURE` environment variable to a value
other than `0`. Alternatively, you can use the `--gtest_break_on_failure`
command line flag.
#### Disabling Catching Test-Thrown Exceptions
googletest can be used either with or without exceptions enabled. If a test
throws a C++ exception or (on Windows) a structured exception (SEH), by default
googletest catches it, reports it as a test failure, and continues with the next
test method. This maximizes the coverage of a test run. Also, on Windows an
uncaught exception will cause a pop-up window, so catching the exceptions allows
you to run the tests automatically.
When debugging the test failures, however, you may instead want the exceptions
to be handled by the debugger, such that you can examine the call stack when an
exception is thrown. To achieve that, set the `GTEST_CATCH_EXCEPTIONS`
environment variable to `0`, or use the `--gtest_catch_exceptions=0` flag when
running the tests.
================================================
FILE: test/googletest/docs/faq.md
================================================
# Googletest FAQ
<!-- GOOGLETEST_CM0014 DO NOT DELETE -->
## Why should test suite names and test names not contain underscore?
Underscore (`_`) is special, as C++ reserves the following to be used by the
compiler and the standard library:
1. any identifier that starts with an `_` followed by an upper-case letter, and
2. any identifier that contains two consecutive underscores (i.e. `__`)
*anywhere* in its name.
User code is *prohibited* from using such identifiers.
Now let's look at what this means for `TEST` and `TEST_F`.
Currently `TEST(TestSuiteName, TestName)` generates a class named
`TestSuiteName_TestName_Test`. What happens if `TestSuiteName` or `TestName`
contains `_`?
1. If `TestSuiteName` starts with an `_` followed by an upper-case letter (say,
`_Foo`), we end up with `_Foo_TestName_Test`, which is reserved and thus
invalid.
2. If `TestSuiteName` ends with an `_` (say, `Foo_`), we get
`Foo__TestName_Test`, which is invalid.
3. If `TestName` starts with an `_` (say, `_Bar`), we get
`TestSuiteName__Bar_Test`, which is invalid.
4. If `TestName` ends with an `_` (say, `Bar_`), we get
`TestSuiteName_Bar__Test`, which is invalid.
So clearly `TestSuiteName` and `TestName` cannot start or end with `_`
(Actually, `TestSuiteName` can start with `_` -- as long as the `_` isn't
followed by an upper-case letter. But that's getting complicated. So for
simplicity we just say that it cannot start with `_`.).
It may seem fine for `TestSuiteName` and `TestName` to contain `_` in the
middle. However, consider this:
```c++
TEST(Time, Flies_Like_An_Arrow) { ... }
TEST(Time_Flies, Like_An_Arrow) { ... }
```
Now, the two `TEST`s will both generate the same class
(`Time_Flies_Like_An_Arrow_Test`). That's not good.
So for simplicity, we just ask the users to avoid `_` in `TestSuiteName` and
`TestName`. The rule is more constraining than necessary, but it's simple and
easy to remember. It also gives googletest some wiggle room in case its
implementation needs to change in the future.
If you violate the rule, there may not be immediate consequences, but your test
may (just may) break with a new compiler (or a new version of the compiler you
are using) or with a new version of googletest. Therefore it's best to follow
the rule.
## Why does googletest support `EXPECT_EQ(NULL, ptr)` and `ASSERT_EQ(NULL, ptr)` but not `EXPECT_NE(NULL, ptr)` and `ASSERT_NE(NULL, ptr)`?
First of all you can use `EXPECT_NE(nullptr, ptr)` and `ASSERT_NE(nullptr,
ptr)`. This is the preferred syntax in the style guide because nullptr does not
have the type problems that NULL does. Which is why NULL does not work.
Due to some peculiarity of C++, it requires some non-trivial template meta
programming tricks to support using `NULL` as an argument of the `EXPECT_XX()`
and `ASSERT_XX()` macros. Therefore we only do it where it's most needed
(otherwise we make the implementation of googletest harder to maintain and more
error-prone than necessary).
The `EXPECT_EQ()` macro takes the *expected* value as its first argument and the
*actual* value as the second. It's reasonable that someone wants to write
`EXPECT_EQ(NULL, some_expression)`, and this indeed was requested several times.
Therefore we implemented it.
The need for `EXPECT_NE(NULL, ptr)` isn't nearly as strong. When the assertion
fails, you already know that `ptr` must be `NULL`, so it doesn't add any
information to print `ptr` in this case. That means `EXPECT_TRUE(ptr != NULL)`
works just as well.
If we were to support `EXPECT_NE(NULL, ptr)`, for consistency we'll have to
support `EXPECT_NE(ptr, NULL)` as well, as unlike `EXPECT_EQ`, we don't have a
convention on the order of the two arguments for `EXPECT_NE`. This means using
the template meta programming tricks twice in the implementation, making it even
harder to understand and maintain. We believe the benefit doesn't justify the
cost.
Finally, with the growth of the gMock matcher library, we are encouraging people
to use the unified `EXPECT_THAT(value, matcher)` syntax more often in tests. One
significant advantage of the matcher approach is that matchers can be easily
combined to form new matchers, while the `EXPECT_NE`, etc, macros cannot be
easily combined. Therefore we want to invest more in the matchers than in the
`EXPECT_XX()` macros.
## I need to test that different implementations of an interface satisfy some common requirements. Should I use typed tests or value-parameterized tests?
For testing various implementations of the same interface, either typed tests or
value-parameterized tests can get it done. It's really up to you the user to
decide which is more convenient for you, depending on your particular case. Some
rough guidelines:
* Typed tests can be easier to write if instances of the different
implementations can be created the same way, modulo the type. For example,
if all these implementations have a public default constructor (such that
you can write `new TypeParam`), or if their factory functions have the same
form (e.g. `CreateInstance<TypeParam>()`).
* Value-parameterized tests can be easier to write if you need different code
patterns to create different implementations' instances, e.g. `new Foo` vs
`new Bar(5)`. To accommodate for the differences, you can write factory
function wrappers and pass these function pointers to the tests as their
parameters.
* When a typed test fails, the default output includes the name of the type,
which can help you quickly identify which implementation is wrong.
Value-parameterized tests only show the number of the failed iteration by
default. You will need to define a function that returns the iteration name
and pass it as the third parameter to INSTANTIATE_TEST_SUITE_P to have more
useful output.
* When using typed tests, you need to make sure you are testing against the
interface type, not the concrete types (in other words, you want to make
sure `implicit_cast<MyInterface*>(my_concrete_impl)` works, not just that
`my_concrete_impl` works). It's less likely to make mistakes in this area
when using value-parameterized tests.
I hope I didn't confuse you more. :-) If you don't mind, I'd suggest you to give
both approaches a try. Practice is a much better way to grasp the subtle
differences between the two tools. Once you have some concrete experience, you
can much more easily decide which one to use the next time.
## I got some run-time errors about invalid proto descriptors when using `ProtocolMessageEquals`. Help!
**Note:** `ProtocolMessageEquals` and `ProtocolMessageEquiv` are *deprecated*
now. Please use `EqualsProto`, etc instead.
`ProtocolMessageEquals` and `ProtocolMessageEquiv` were redefined recently and
are now less tolerant of invalid protocol buffer definitions. In particular, if
you have a `foo.proto` that doesn't fully qualify the type of a protocol message
it references (e.g. `message<Bar>` where it should be `message<blah.Bar>`), you
will now get run-time errors like:
```
... descriptor.cc:...] Invalid proto descriptor for file "path/to/foo.proto":
... descriptor.cc:...] blah.MyMessage.my_field: ".Bar" is not defined.
```
If you see this, your `.proto` file is broken and needs to be fixed by making
the types fully qualified. The new definition of `ProtocolMessageEquals` and
`ProtocolMessageEquiv` just happen to reveal your bug.
## My death test modifies some state, but the change seems lost after the death test finishes. Why?
Death tests (`EXPECT_DEATH`, etc) are executed in a sub-process s.t. the
expected crash won't kill the test program (i.e. the parent process). As a
result, any in-memory side effects they incur are observable in their respective
sub-processes, but not in the parent process. You can think of them as running
in a parallel universe, more or less.
In particular, if you use mocking and the death test statement invokes some mock
methods, the parent process will think the calls have never occurred. Therefore,
you may want to move your `EXPECT_CALL` statements inside the `EXPECT_DEATH`
macro.
## EXPECT_EQ(htonl(blah), blah_blah) generates weird compiler errors in opt mode. Is this a googletest bug?
Actually, the bug is in `htonl()`.
According to `'man htonl'`, `htonl()` is a *function*, which means it's valid to
use `htonl` as a function pointer. However, in opt mode `htonl()` is defined as
a *macro*, which breaks this usage.
Worse, the macro definition of `htonl()` uses a `gcc` extension and is *not*
standard C++. That hacky implementation has some ad hoc limitations. In
particular, it prevents you from writing `Foo<sizeof(htonl(x))>()`, where `Foo`
is a template that has an integral argument.
The implementation of `EXPECT_EQ(a, b)` uses `sizeof(... a ...)` inside a
template argument, and thus doesn't compile in opt mode when `a` contains a call
to `htonl()`. It is difficult to make `EXPECT_EQ` bypass the `htonl()` bug, as
the solution must work with different compilers on various platforms.
`htonl()` has some other problems as described in `//util/endian/endian.h`,
which defines `ghtonl()` to replace it. `ghtonl()` does the same thing `htonl()`
does, only without its problems. We suggest you to use `ghtonl()` instead of
`htonl()`, both in your tests and production code.
`//util/endian/endian.h` also defines `ghtons()`, which solves similar problems
in `htons()`.
Don't forget to add `//util/endian` to the list of dependencies in the `BUILD`
file wherever `ghtonl()` and `ghtons()` are used. The library consists of a
single header file and will not bloat your binary.
## The compiler complains about "undefined references" to some static const member variables, but I did define them in the class body. What's wrong?
If your class has a static data member:
```c++
// foo.h
class Foo {
...
static const int kBar = 100;
};
```
You also need to define it *outside* of the class body in `foo.cc`:
```c++
const int Foo::kBar; // No initializer here.
```
Otherwise your code is **invalid C++**, and may break in unexpected ways. In
particular, using it in googletest comparison assertions (`EXPECT_EQ`, etc) will
generate an "undefined reference" linker error. The fact that "it used to work"
doesn't mean it's valid. It just means that you were lucky. :-)
## Can I derive a test fixture from another?
Yes.
Each test fixture has a corresponding and same named test suite. This means only
one test suite can use a particular fixture. Sometimes, however, multiple test
cases may want to use the same or slightly different fixtures. For example, you
may want to make sure that all of a GUI library's test suites don't leak
important system resources like fonts and brushes.
In googletest, you share a fixture among test suites by putting the shared logic
in a base test fixture, then deriving from that base a separate fixture for each
test suite that wants to use this common logic. You then use `TEST_F()` to write
tests using each derived fixture.
Typically, your code looks like this:
```c++
// Defines a base test fixture.
class BaseTest : public ::testing::Test {
protected:
...
};
// Derives a fixture FooTest from BaseTest.
class FooTest : public BaseTest {
protected:
void SetUp() override {
BaseTest::SetUp(); // Sets up the base fixture first.
... additional set-up work ...
}
void TearDown() override {
... clean-up work for FooTest ...
BaseTest::TearDown(); // Remember to tear down the base fixture
// after cleaning up FooTest!
}
... functions and variables for FooTest ...
};
// Tests that use the fixture FooTest.
TEST_F(FooTest, Bar) { ... }
TEST_F(FooTest, Baz) { ... }
... additional fixtures derived from BaseTest ...
```
If necessary, you can continue to derive test fixtures from a derived fixture.
googletest has no limit on how deep the hierarchy can be.
For a complete example using derived test fixtures, see
[sample5_unittest.cc](../samples/sample5_unittest.cc).
## My compiler complains "void value not ignored as it ought to be." What does this mean?
You're probably using an `ASSERT_*()` in a function that doesn't return `void`.
`ASSERT_*()` can only be used in `void` functions, due to exceptions being
disabled by our build system. Please see more details
[here](advanced.md#assertion-placement).
## My death test hangs (or seg-faults). How do I fix it?
In googletest, death tests are run in a child process and the way they work is
delicate. To write death tests you really need to understand how they work.
Please make sure you have read [this](advanced.md#how-it-works).
In particular, death tests don't like having multiple threads in the parent
process. So the first thing you can try is to eliminate creating threads outside
of `EXPECT_DEATH()`. For example, you may want to use mocks or fake objects
instead of real ones in your tests.
Sometimes this is impossible as some library you must use may be creating
threads before `main()` is even reached. In this case, you can try to minimize
the chance of conflicts by either moving as many activities as possible inside
`EXPECT_DEATH()` (in the extreme case, you want to move everything inside), or
leaving as few things as possible in it. Also, you can try to set the death test
style to `"threadsafe"`, which is safer but slower, and see if it helps.
If you go with thread-safe death tests, remember that they rerun the test
program from the beginning in the child process. Therefore make sure your
program can run side-by-side with itself and is deterministic.
In the end, this boils down to good concurrent programming. You have to make
sure that there is no race conditions or dead locks in your program. No silver
bullet - sorry!
## Should I use the constructor/destructor of the test fixture or SetUp()/TearDown()? {#CtorVsSetUp}
The first thing to remember is that googletest does **not** reuse the same test
fixture object across multiple tests. For each `TEST_F`, googletest will create
a **fresh** test fixture object, immediately call `SetUp()`, run the test body,
call `TearDown()`, and then delete the test fixture object.
When you need to write per-test set-up and tear-down logic, you have the choice
between using the test fixture constructor/destructor or `SetUp()/TearDown()`.
The former is usually preferred, as it has the following benefits:
* By initializing a member variable in the constructor, we have the option to
make it `const`, which helps prevent accidental changes to its value and
makes the tests more obviously correct.
* In case we need to subclass the test fixture class, the subclass'
constructor is guaranteed to call the base class' constructor *first*, and
the subclass' destructor is guaranteed to call the base class' destructor
*afterward*. With `SetUp()/TearDown()`, a subclass may make the mistake of
forgetting to call the base class' `SetUp()/TearDown()` or call them at the
wrong time.
You may still want to use `SetUp()/TearDown()` in the following cases:
* C++ does not allow virtual function calls in constructors and destructors.
You can call a method declared as virtual, but it will not use dynamic
dispatch, it will use the definition from the class the constructor of which
is currently executing. This is because calling a virtual method before the
derived class constructor has a chance to run is very dangerous - the
virtual method might operate on uninitialized data. Therefore, if you need
to call a method that will be overridden in a derived class, you have to use
`SetUp()/TearDown()`.
* In the body of a constructor (or destructor), it's not possible to use the
`ASSERT_xx` macros. Therefore, if the set-up operation could cause a fatal
test failure that should prevent the test from running, it's necessary to
use `abort` <!-- GOOGLETEST_CM0015 DO NOT DELETE --> and abort the whole test executable,
or to use `SetUp()` instead of a constructor.
* If the tear-down operation could throw an exception, you must use
`TearDown()` as opposed to the destructor, as throwing in a destructor leads
to undefined behavior and usually will kill your program right away. Note
that many standard libraries (like STL) may throw when exceptions are
enabled in the compiler. Therefore you should prefer `TearDown()` if you
want to write portable tests that work with or without exceptions.
* The googletest team is considering making the assertion macros throw on
platforms where exceptions are enabled (e.g. Windows, Mac OS, and Linux
client-side), which will eliminate the need for the user to propagate
failures from a subroutine to its caller. Therefore, you shouldn't use
googletest assertions in a destructor if your code could run on such a
platform.
## The compiler complains "no matching function to call" when I use ASSERT_PRED*. How do I fix it?
If the predicate function you use in `ASSERT_PRED*` or `EXPECT_PRED*` is
overloaded or a template, the compiler will have trouble figuring out which
overloaded version it should use. `ASSERT_PRED_FORMAT*` and
`EXPECT_PRED_FORMAT*` don't have this problem.
If you see this error, you might want to switch to
`(ASSERT|EXPECT)_PRED_FORMAT*`, which will also give you a better failure
message. If, however, that is not an option, you can resolve the problem by
explicitly telling the compiler which version to pick.
For example, suppose you have
```c++
bool IsPositive(int n) {
return n > 0;
}
bool IsPositive(double x) {
return x > 0;
}
```
you will get a compiler error if you write
```c++
EXPECT_PRED1(IsPositive, 5);
```
However, this will work:
```c++
EXPECT_PRED1(static_cast<bool (*)(int)>(IsPositive), 5);
```
(The stuff inside the angled brackets for the `static_cast` operator is the type
of the function pointer for the `int`-version of `IsPositive()`.)
As another example, when you have a template function
```c++
template <typename T>
bool IsNegative(T x) {
return x < 0;
}
```
you can use it in a predicate assertion like this:
```c++
ASSERT_PRED1(IsNegative<int>, -5);
```
Things are more interesting if your template has more than one parameters. The
following won't compile:
```c++
ASSERT_PRED2(GreaterThan<int, int>, 5, 0);
```
as the C++ pre-processor thinks you are giving `ASSERT_PRED2` 4 arguments, which
is one more than expected. The workaround is to wrap the predicate function in
parentheses:
```c++
ASSERT_PRED2((GreaterThan<int, int>), 5, 0);
```
## My compiler complains about "ignoring return value" when I call RUN_ALL_TESTS(). Why?
Some people had been ignoring the return value of `RUN_ALL_TESTS()`. That is,
instead of
```c++
return RUN_ALL_TESTS();
```
they write
```c++
RUN_ALL_TESTS();
```
This is **wrong and dangerous**. The testing services needs to see the return
value of `RUN_ALL_TESTS()` in order to determine if a test has passed. If your
`main()` function ignores it, your test will be considered successful even if it
has a googletest assertion failure. Very bad.
We have decided to fix this (thanks to Michael Chastain for the idea). Now, your
code will no longer be able to ignore `RUN_ALL_TESTS()` when compiled with
`gcc`. If you do so, you'll get a compiler error.
If you see the compiler complaining about you ignoring the return value of
`RUN_ALL_TESTS()`, the fix is simple: just make sure its value is used as the
return value of `main()`.
But how could we introduce a change that breaks existing tests? Well, in this
case, the code was already broken in the first place, so we didn't break it. :-)
## My compiler complains that a constructor (or destructor) cannot return a value. What's going on?
Due to a peculiarity of C++, in order to support the syntax for streaming
messages to an `ASSERT_*`, e.g.
```c++
ASSERT_EQ(1, Foo()) << "blah blah" << foo;
```
we had to give up using `ASSERT*` and `FAIL*` (but not `EXPECT*` and
`ADD_FAILURE*`) in constructors and destructors. The workaround is to move the
content of your constructor/destructor to a private void member function, or
switch to `EXPECT_*()` if that works. This
[section](advanced.md#assertion-placement) in the user's guide explains it.
## My SetUp() function is not called. Why?
C++ is case-sensitive. Did you spell it as `Setup()`?
Similarly, sometimes people spell `SetUpTestSuite()` as `SetupTestSuite()` and
wonder why it's never called.
## I have several test suites which share the same test fixture logic, do I have to define a new test fixture class for each of them? This seems pretty tedious.
You don't have to. Instead of
```c++
class FooTest : public BaseTest {};
TEST_F(FooTest, Abc) { ... }
TEST_F(FooTest, Def) { ... }
class BarTest : public BaseTest {};
TEST_F(BarTest, Abc) { ... }
TEST_F(BarTest, Def) { ... }
```
you can simply `typedef` the test fixtures:
```c++
typedef BaseTest FooTest;
TEST_F(FooTest, Abc) { ... }
TEST_F(FooTest, Def) { ... }
typedef BaseTest BarTest;
TEST_F(BarTest, Abc) { ... }
TEST_F(BarTest, Def) { ... }
```
## googletest output is buried in a whole bunch of LOG messages. What do I do?
The googletest output is meant to be a concise and human-friendly report. If
your test generates textual output itself, it will mix with the googletest
output, making it hard to read. However, there is an easy solution to this
problem.
Since `LOG` messages go to stderr, we decided to let googletest output go to
stdout. This way, you can easily separate the two using redirection. For
example:
```shell
$ ./my_test > gtest_output.txt
```
## Why should I prefer test fixtures over global variables?
There are several good reasons:
1. It's likely your test needs to change the states of its global variables.
This makes it difficult to keep side effects from escaping one test and
contaminating others, making debugging difficult. By using fixtures, each
test has a fresh set of variables that's different (but with the same
names). Thus, tests are kept independent of each other.
2. Global variables pollute the global namespace.
3. Test fixtures can be reused via subclassing, which cannot be done easily
with global variables. This is useful if many test suites have something in
common.
## What can the statement argument in ASSERT_DEATH() be?
`ASSERT_DEATH(statement, matcher)` (or any death assertion macro) can be used
wherever *`statement`* is valid. So basically *`statement`* can be any C++
statement that makes sense in the current context. In particular, it can
reference global and/or local variables, and can be:
* a simple function call (often the case),
* a complex expression, or
* a compound statement.
Some examples are shown here:
```c++
// A death test can be a simple function call.
TEST(MyDeathTest, FunctionCall) {
ASSERT_DEATH(Xyz(5), "Xyz failed");
}
// Or a complex expression that references variables and functions.
TEST(MyDeathTest, ComplexExpression) {
const bool c = Condition();
ASSERT_DEATH((c ? Func1(0) : object2.Method("test")),
"(Func1|Method) failed");
}
// Death assertions can be used any where in a function. In
// particular, they can be inside a loop.
TEST(MyDeathTest, InsideLoop) {
// Verifies that Foo(0), Foo(1), ..., and Foo(4) all die.
for (int i = 0; i < 5; i++) {
EXPECT_DEATH_M(Foo(i), "Foo has \\d+ errors",
::testing::Message() << "where i is " << i);
}
}
// A death assertion can contain a compound statement.
TEST(MyDeathTest, CompoundStatement) {
// Verifies that at lease one of Bar(0), Bar(1), ..., and
// Bar(4) dies.
ASSERT_DEATH({
for (int i = 0; i < 5; i++) {
Bar(i);
}
},
"Bar has \\d+ errors");
}
```
gtest-death-test_test.cc contains more examples if you are interested.
## I have a fixture class `FooTest`, but `TEST_F(FooTest, Bar)` gives me error ``"no matching function for call to `FooTest::FooTest()'"``. Why?
Googletest needs to be able to create objects of your test fixture class, so it
must have a default constructor. Normally the compiler will define one for you.
However, there are cases where you have to define your own:
* If you explicitly declare a non-default constructor for class `FooTest`
(`DISALLOW_EVIL_CONSTRUCTORS()` does this), then you need to define a
default constructor, even if it would be empty.
* If `FooTest` has a const non-static data member, then you have to define the
default constructor *and* initialize the const member in the initializer
list of the constructor. (Early versions of `gcc` doesn't force you to
initialize the const member. It's a bug that has been fixed in `gcc 4`.)
## Why does ASSERT_DEATH complain about previous threads that were already joined?
With the Linux pthread library, there is no turning back once you cross the line
from single thread to multiple threads. The first time you create a thread, a
manager thread is created in addition, so you get 3, not 2, threads. Later when
the thread you create joins the main thread, the thread count decrements by 1,
but the manager thread will never be killed, so you still have 2 threads, which
means you cannot safely run a death test.
The new NPTL thread library doesn't suffer from this problem, as it doesn't
create a manager thread. However, if you don't control which machine your test
runs on, you shouldn't depend on this.
## Why does googletest require the entire test suite, instead of individual tests, to be named *DeathTest when it uses ASSERT_DEATH?
googletest does not interleave tests from different test suites. That is, it
runs all tests in one test suite first, and then runs all tests in the next test
suite, and so on. googletest does this because it needs to set up a test suite
before the first test in it is run, and tear it down afterwords. Splitting up
the test case would require multiple set-up and tear-down processes, which is
inefficient and makes the semantics unclean.
If we were to determine the order of tests based on test name instead of test
case name, then we would have a problem with the following situation:
```c++
TEST_F(FooTest, AbcDeathTest) { ... }
TEST_F(FooTest, Uvw) { ... }
TEST_F(BarTest, DefDeathTest) { ... }
TEST_F(BarTest, Xyz) { ... }
```
Since `FooTest.AbcDeathTest` needs to run before `BarTest.Xyz`, and we don't
interleave tests from different test suites, we need to run all tests in the
`FooTest` case before running any test in the `BarTest` case. This contradicts
with the requirement to run `BarTest.DefDeathTest` before `FooTest.Uvw`.
## But I don't like calling my entire test suite \*DeathTest when it contains both death tests and non-death tests. What do I do?
You don't have to, but if you like, you may split up the test suite into
`FooTest` and `FooDeathTest`, where the names make it clear that they are
related:
```c++
class FooTest : public ::testing::Test { ... };
TEST_F(FooTest, Abc) { ... }
TEST_F(FooTest, Def) { ... }
using FooDeathTest = FooTest;
TEST_F(FooDeathTest, Uvw) { ... EXPECT_DEATH(...) ... }
TEST_F(FooDeathTest, Xyz) { ... ASSERT_DEATH(...) ... }
```
## googletest prints the LOG messages in a death test's child process only when the test fails. How can I see the LOG messages when the death test succeeds?
Printing the LOG messages generated by the statement inside `EXPECT_DEATH()`
makes it harder to search for real problems in the parent's log. Therefore,
googletest only prints them when the death test has failed.
If you really need to see such LOG messages, a workaround is to temporarily
break the death test (e.g. by changing the regex pattern it is expected to
match). Admittedly, this is a hack. We'll consider a more permanent solution
after the fork-and-exec-style death tests are implemented.
## The compiler complains about "no match for 'operator<<'" when I use an assertion. What gives?
If you use a user-defined type `FooType` in an assertion, you must make sure
there is an `std::ostream& operator<<(std::ostream&, const FooType&)` function
defined such that we can print a value of `FooType`.
In addition, if `FooType` is declared in a name space, the `<<` operator also
needs to be defined in the *same* name space. See https://abseil.io/tips/49 for details.
## How do I suppress the memory leak messages on Windows?
Since the statically initialized googletest singleton requires allocations on
the heap, the Visual C++ memory leak detector will report memory leaks at th
gitextract_oz4sj7oe/
├── .github/
│ └── workflows/
│ └── ccpp.yml
├── .gitignore
├── CMakeLists.txt
├── README.md
├── build.sh
├── src/
│ ├── CMakeLists.txt
│ ├── inifile.cpp
│ └── inifile.h
└── test/
├── CMakeLists.txt
├── googletest/
│ ├── CMakeLists.txt
│ ├── CONTRIBUTORS
│ ├── LICENSE
│ ├── README.md
│ ├── cmake/
│ │ ├── Config.cmake.in
│ │ ├── gtest.pc.in
│ │ ├── gtest_main.pc.in
│ │ ├── internal_utils.cmake
│ │ └── libgtest.la.in
│ ├── docs/
│ │ ├── advanced.md
│ │ ├── faq.md
│ │ ├── pkgconfig.md
│ │ ├── primer.md
│ │ └── samples.md
│ ├── include/
│ │ └── gtest/
│ │ ├── gtest-death-test.h
│ │ ├── gtest-matchers.h
│ │ ├── gtest-message.h
│ │ ├── gtest-param-test.h
│ │ ├── gtest-printers.h
│ │ ├── gtest-spi.h
│ │ ├── gtest-test-part.h
│ │ ├── gtest-typed-test.h
│ │ ├── gtest.h
│ │ ├── gtest_pred_impl.h
│ │ ├── gtest_prod.h
│ │ └── internal/
│ │ ├── custom/
│ │ │ ├── README.md
│ │ │ ├── gtest-port.h
│ │ │ ├── gtest-printers.h
│ │ │ └── gtest.h
│ │ ├── gtest-death-test-internal.h
│ │ ├── gtest-filepath.h
│ │ ├── gtest-internal.h
│ │ ├── gtest-param-util.h
│ │ ├── gtest-port-arch.h
│ │ ├── gtest-port.h
│ │ ├── gtest-string.h
│ │ └── gtest-type-util.h
│ ├── samples/
│ │ ├── prime_tables.h
│ │ ├── sample1.cc
│ │ ├── sample1.h
│ │ ├── sample10_unittest.cc
│ │ ├── sample1_unittest.cc
│ │ ├── sample2.cc
│ │ ├── sample2.h
│ │ ├── sample2_unittest.cc
│ │ ├── sample3-inl.h
│ │ ├── sample3_unittest.cc
│ │ ├── sample4.cc
│ │ ├── sample4.h
│ │ ├── sample4_unittest.cc
│ │ ├── sample5_unittest.cc
│ │ ├── sample6_unittest.cc
│ │ ├── sample7_unittest.cc
│ │ ├── sample8_unittest.cc
│ │ └── sample9_unittest.cc
│ ├── scripts/
│ │ ├── README.md
│ │ ├── common.py
│ │ ├── fuse_gtest_files.py
│ │ ├── gen_gtest_pred_impl.py
│ │ ├── gtest-config.in
│ │ ├── release_docs.py
│ │ ├── run_with_path.py
│ │ ├── test/
│ │ │ └── Makefile
│ │ ├── upload.py
│ │ └── upload_gtest.py
│ ├── src/
│ │ ├── gtest-all.cc
│ │ ├── gtest-death-test.cc
│ │ ├── gtest-filepath.cc
│ │ ├── gtest-internal-inl.h
│ │ ├── gtest-matchers.cc
│ │ ├── gtest-port.cc
│ │ ├── gtest-printers.cc
│ │ ├── gtest-test-part.cc
│ │ ├── gtest-typed-test.cc
│ │ ├── gtest.cc
│ │ └── gtest_main.cc
│ └── test/
│ ├── BUILD.bazel
│ ├── googletest-break-on-failure-unittest.py
│ ├── googletest-break-on-failure-unittest_.cc
│ ├── googletest-catch-exceptions-test.py
│ ├── googletest-catch-exceptions-test_.cc
│ ├── googletest-color-test.py
│ ├── googletest-color-test_.cc
│ ├── googletest-death-test-test.cc
│ ├── googletest-death-test_ex_test.cc
│ ├── googletest-env-var-test.py
│ ├── googletest-env-var-test_.cc
│ ├── googletest-filepath-test.cc
│ ├── googletest-filter-unittest.py
│ ├── googletest-filter-unittest_.cc
│ ├── googletest-json-outfiles-test.py
│ ├── googletest-json-output-unittest.py
│ ├── googletest-list-tests-unittest.py
│ ├── googletest-list-tests-unittest_.cc
│ ├── googletest-listener-test.cc
│ ├── googletest-message-test.cc
│ ├── googletest-options-test.cc
│ ├── googletest-output-test-golden-lin.txt
│ ├── googletest-output-test.py
│ ├── googletest-output-test_.cc
│ ├── googletest-param-test-invalid-name1-test.py
│ ├── googletest-param-test-invalid-name1-test_.cc
│ ├── googletest-param-test-invalid-name2-test.py
│ ├── googletest-param-test-invalid-name2-test_.cc
│ ├── googletest-param-test-test.cc
│ ├── googletest-param-test-test.h
│ ├── googletest-param-test2-test.cc
│ ├── googletest-port-test.cc
│ ├── googletest-printers-test.cc
│ ├── googletest-shuffle-test.py
│ ├── googletest-shuffle-test_.cc
│ ├── googletest-test-part-test.cc
│ ├── googletest-test2_test.cc
│ ├── googletest-throw-on-failure-test.py
│ ├── googletest-throw-on-failure-test_.cc
│ ├── googletest-uninitialized-test.py
│ ├── googletest-uninitialized-test_.cc
│ ├── gtest-typed-test2_test.cc
│ ├── gtest-typed-test_test.cc
│ ├── gtest-typed-test_test.h
│ ├── gtest-unittest-api_test.cc
│ ├── gtest_all_test.cc
│ ├── gtest_assert_by_exception_test.cc
│ ├── gtest_environment_test.cc
│ ├── gtest_help_test.py
│ ├── gtest_help_test_.cc
│ ├── gtest_json_test_utils.py
│ ├── gtest_list_output_unittest.py
│ ├── gtest_list_output_unittest_.cc
│ ├── gtest_main_unittest.cc
│ ├── gtest_no_test_unittest.cc
│ ├── gtest_pred_impl_unittest.cc
│ ├── gtest_premature_exit_test.cc
│ ├── gtest_prod_test.cc
│ ├── gtest_repeat_test.cc
│ ├── gtest_skip_check_output_test.py
│ ├── gtest_skip_environment_check_output_test.py
│ ├── gtest_skip_in_environment_setup_test.cc
│ ├── gtest_skip_test.cc
│ ├── gtest_sole_header_test.cc
│ ├── gtest_stress_test.cc
│ ├── gtest_test_macro_stack_footprint_test.cc
│ ├── gtest_test_utils.py
│ ├── gtest_testbridge_test.py
│ ├── gtest_testbridge_test_.cc
│ ├── gtest_throw_on_failure_ex_test.cc
│ ├── gtest_unittest.cc
│ ├── gtest_xml_outfile1_test_.cc
│ ├── gtest_xml_outfile2_test_.cc
│ ├── gtest_xml_outfiles_test.py
│ ├── gtest_xml_output_unittest.py
│ ├── gtest_xml_output_unittest_.cc
│ ├── gtest_xml_test_utils.py
│ ├── production.cc
│ └── production.h
└── inifile_test.cpp
Showing preview only (346K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (2986 symbols across 123 files)
FILE: src/inifile.cpp
type inifile (line 36) | namespace inifile
function IniSection (line 247) | IniSection *IniFile::getSection(const string §ion /*=""*/)
function string (line 717) | const string & IniFile::GetErrMsg()
FILE: src/inifile.h
function namespace (line 58) | namespace inifile
function class (line 84) | class IniFile
FILE: test/googletest/include/gtest/gtest-death-test.h
function namespace (line 43) | namespace testing {
FILE: test/googletest/include/gtest/gtest-matchers.h
function namespace (line 63) | namespace testing {
function explicit (line 357) | explicit Matcher(const MatcherInterface<const std::string&>* impl)
function explicit (line 376) | explicit Matcher(const MatcherInterface<std::string>* impl)
function explicit (line 397) | explicit Matcher(const MatcherInterface<const absl::string_view&>* impl)
function explicit (line 419) | explicit Matcher(const MatcherInterface<absl::string_view>* impl)
function DescribeTo (line 477) | void DescribeTo(::std::ostream* os) const override { impl_.DescribeTo(os...
function DescribeNegationTo (line 479) | void DescribeNegationTo(::std::ostream* os) const override {
function MatchAndExplain (line 483) | bool MatchAndExplain(T x, MatchResultListener* listener) const override {
function namespace (line 517) | namespace internal {
function DescribeTo (line 652) | void DescribeTo(::std::ostream* os) const {
function DescribeNegationTo (line 657) | void DescribeNegationTo(::std::ostream* os) const {
function PolymorphicMatcher (line 671) | inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
function PolymorphicMatcher (line 675) | inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
function PolymorphicMatcher (line 682) | inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
function PolymorphicMatcher (line 686) | inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
FILE: test/googletest/include/gtest/gtest-message.h
function namespace (line 63) | namespace testing {
function namespace (line 203) | namespace internal {
FILE: test/googletest/include/gtest/gtest-param-test.h
function class (line 159) | class BaseTest : public ::testing::Test {
function namespace (line 186) | namespace testing {
function internal (line 361) | inline internal::ParamGenerator<bool> Bool() {
FILE: test/googletest/include/gtest/gtest-printers.h
function namespace (line 120) | namespace testing {
function namespace (line 255) | namespace testing_internal {
function namespace (line 292) | namespace testing {
function string (line 377) | string FormatForComparisonFailureMessage(
type DefaultPrinterType (line 395) | enum DefaultPrinterType {
function ostream (line 483) | ostream* os) {
function PrintTo (line 523) | inline void PrintTo(char c, ::std::ostream* os) {
function PrintTo (line 531) | inline void PrintTo(bool x, ::std::ostream* os) {
function PrintTo (line 546) | inline void PrintTo(char* s, ::std::ostream* os) {
function PrintTo (line 552) | inline void PrintTo(const signed char* s, ::std::ostream* os) {
function PrintTo (line 555) | inline void PrintTo(signed char* s, ::std::ostream* os) {
function PrintTo (line 558) | inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
function PrintTo (line 561) | inline void PrintTo(unsigned char* s, ::std::ostream* os) {
function PrintTo (line 573) | inline void PrintTo(wchar_t* s, ::std::ostream* os) {
function PrintTo (line 594) | inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
function PrintTo (line 601) | inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
function PrintTo (line 608) | inline void PrintTo(absl::string_view sp, ::std::ostream* os) {
function PrintTo (line 613) | inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullp...
function ostream (line 628) | ostream* os) {
function Print (line 670) | static void Print(const T& value, ::std::ostream* os) {
function Print (line 777) | static void Print(const T& value, ::std::ostream* os) {
function Print (line 817) | static void Print(const char* str, ::std::ostream* os) {
FILE: test/googletest/include/gtest/gtest-spi.h
function namespace (line 44) | namespace testing {
FILE: test/googletest/include/gtest/gtest-test-part.h
function namespace (line 43) | namespace testing {
function class (line 129) | class GTEST_API_ TestPartResultArray {
function class (line 149) | class GTEST_API_ TestPartResultReporterInterface {
function namespace (line 156) | namespace internal {
FILE: test/googletest/include/gtest/gtest-typed-test.h
type testing (line 57) | typedef testing::Types<char, int, unsigned int> MyTypes;
type testing (line 158) | typedef testing::Types<char, int, unsigned int> MyTypes;
FILE: test/googletest/include/gtest/gtest.h
function namespace (line 76) | namespace testing {
function namespace (line 377) | namespace testing {
function class (line 1542) | class EqHelper {
function namespace (line 1720) | namespace internal {
function class (line 1767) | class GTEST_API_ AssertHelper {
type GTestColor (line 1806) | enum GTestColor { COLOR_DEFAULT, COLOR_RED, COLOR_GREEN, COLOR_YELLOW }
function GTEST_API_ (line 1808) | GTEST_API_ GTEST_ATTRIBUTE_PRINTF_(2, 3) void ColoredPrintf(GTestColor c...
function ParamType (line 1856) | static const ParamType& GetParam() {
function class (line 2215) | class GTEST_API_ ScopedTrace {
function StaticAssertTypeEq (line 2300) | bool StaticAssertTypeEq() noexcept {
function class (line 2442) | class FactoryImpl : public internal::TestFactoryBase {
FILE: test/googletest/include/gtest/gtest_pred_impl.h
function namespace (line 41) | namespace testing {
FILE: test/googletest/include/gtest/internal/gtest-death-test-internal.h
function namespace (line 45) | namespace testing {
FILE: test/googletest/include/gtest/internal/gtest-filepath.h
function pathname_ (line 65) | FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
function explicit (line 67) | explicit FilePath(const std::string& pathname) : pathname_(pathname) {
function Set (line 76) | void Set(const FilePath& rhs) {
FILE: test/googletest/include/gtest/internal/gtest-internal.h
function namespace (line 83) | namespace proto2 { class Message; }
function namespace (line 85) | namespace testing {
type RelationToSourceReference (line 1032) | struct RelationToSourceReference {}
type RelationToSourceCopy (line 1033) | struct RelationToSourceCopy {}
type Element (line 1048) | typedef Element* iterator;
type Element (line 1049) | typedef const Element* const_iterator;
function InitCopy (line 1086) | void InitCopy(const Element* array, size_t a_size) {
function InitRef (line 1095) | void InitRef(const Element* array, size_t a_size) {
type MakeIndexSequence (line 1134) | struct MakeIndexSequence
function explicit (line 1170) | explicit FlatTupleElemBase(value_type t) : value(std::move(t)) {}
function explicit (line 1182) | explicit FlatTupleBase(T... t)
function explicit (line 1203) | explicit FlatTuple(T... t) : FlatTuple::FlatTupleBase(std::move(t)...) {}
function InstantiateTestCase_P_IsDeprecated (line 1221) | constexpr bool InstantiateTestCase_P_IsDeprecated() { return true; }
function TypedTestCase_P_IsDeprecated (line 1226) | constexpr bool TypedTestCase_P_IsDeprecated() { return true; }
function TypedTestCaseIsDeprecated (line 1231) | constexpr bool TypedTestCaseIsDeprecated() { return true; }
function RegisterTypedTestCase_P_IsDeprecated (line 1236) | constexpr bool RegisterTypedTestCase_P_IsDeprecated() { return true; }
function InstantiateTypedTestCase_P_IsDeprecated (line 1241) | constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
FILE: test/googletest/include/gtest/internal/gtest-param-util.h
type PrintToStringParamName (line 66) | struct PrintToStringParamName {
type T (line 124) | typedef const T& reference;
type difference_type (line 125) | typedef ptrdiff_t difference_type;
function impl_ (line 128) | ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
FILE: test/googletest/include/gtest/internal/gtest-port.h
type GTEST_CRITICAL_SECTION (line 337) | typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
type GTEST_CRITICAL_SECTION (line 342) | typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
function namespace (line 818) | namespace testing {
function To (line 1036) | To ImplicitCast_(To x) { return x; }
function To (line 1060) | To DownCast_(From* f) { // so we only accept pointers
function SleepMilliseconds (line 1138) | inline void SleepMilliseconds(int n) {
function class (line 1158) | class Notification {
function class (line 1201) | class GTEST_API_ AutoHandle {
FILE: test/googletest/include/gtest/internal/gtest-string.h
function namespace (line 54) | namespace testing {
FILE: test/googletest/include/gtest/internal/gtest-type-util.h
function namespace (line 48) | namespace testing {
FILE: test/googletest/samples/prime_tables.h
function class (line 42) | class PrimeTable {
function class (line 55) | class OnTheFlyPrimeTable : public PrimeTable {
function class (line 79) | class PreCalculatedPrimeTable : public PrimeTable {
function IsPrime (line 88) | bool IsPrime(int n) const override {
function GetNextPrime (line 92) | int GetNextPrime(int p) const override {
FILE: test/googletest/samples/sample1.cc
function Factorial (line 35) | int Factorial(int n) {
function IsPrime (line 45) | bool IsPrime(int n) {
FILE: test/googletest/samples/sample10_unittest.cc
class Water (line 47) | class Water {
method allocated (line 62) | static int allocated() { return allocated_; }
class LeakChecker (line 74) | class LeakChecker : public EmptyTestEventListener {
method OnTestStart (line 77) | void OnTestStart(const TestInfo& /* test_info */) override {
method OnTestEnd (line 82) | void OnTestEnd(const TestInfo& /* test_info */) override {
function TEST (line 94) | TEST(ListenersTest, DoesNotLeak) {
function TEST (line 101) | TEST(ListenersTest, LeaksWater) {
function main (line 107) | int main(int argc, char **argv) {
FILE: test/googletest/samples/sample1_unittest.cc
function TEST (line 76) | TEST(FactorialTest, Negative) {
function TEST (line 100) | TEST(FactorialTest, Zero) {
function TEST (line 105) | TEST(FactorialTest, Positive) {
function TEST (line 116) | TEST(IsPrimeTest, Negative) {
function TEST (line 125) | TEST(IsPrimeTest, Trivial) {
function TEST (line 133) | TEST(IsPrimeTest, Positive) {
FILE: test/googletest/samples/sample2.h
function class (line 39) | class MyString {
FILE: test/googletest/samples/sample2_unittest.cc
function TEST (line 46) | TEST(MyString, DefaultConstructor) {
function TEST (line 77) | TEST(MyString, ConstructorFromCString) {
function TEST (line 85) | TEST(MyString, CopyConstructor) {
function TEST (line 92) | TEST(MyString, Set) {
FILE: test/googletest/samples/sample3-inl.h
function QueueNode (line 55) | QueueNode* next() { return next_; }
function QueueNode (line 56) | const QueueNode* next() const { return next_; }
function Clear (line 82) | void Clear() {
function QueueNode (line 105) | const QueueNode<E>* Head() const { return head_; }
function QueueNode (line 109) | const QueueNode<E>* Last() const { return last_; }
function Enqueue (line 115) | void Enqueue(const E& element) {
function E (line 130) | E* Dequeue() {
FILE: test/googletest/samples/sample3_unittest.cc
class QueueTestSmpl3 (line 67) | class QueueTestSmpl3 : public testing::Test {
method SetUp (line 74) | void SetUp() override {
method Double (line 88) | static int Double(int n) {
method MapTester (line 93) | void MapTester(const Queue<int> * q) {
function TEST_F (line 120) | TEST_F(QueueTestSmpl3, DefaultConstructor) {
function TEST_F (line 126) | TEST_F(QueueTestSmpl3, Dequeue) {
function TEST_F (line 144) | TEST_F(QueueTestSmpl3, Map) {
FILE: test/googletest/samples/sample4.h
function class (line 35) | class Counter {
FILE: test/googletest/samples/sample4_unittest.cc
function TEST (line 37) | TEST(Counter, Increment) {
FILE: test/googletest/samples/sample5_unittest.cc
class QuickTest (line 62) | class QuickTest : public testing::Test {
method SetUp (line 66) | void SetUp() override { start_time_ = time(nullptr); }
method TearDown (line 70) | void TearDown() override {
class IntegerFunctionTest (line 88) | class IntegerFunctionTest : public QuickTest {
function TEST_F (line 97) | TEST_F(IntegerFunctionTest, Factorial) {
function TEST_F (line 115) | TEST_F(IntegerFunctionTest, IsPrime) {
class QueueTest (line 141) | class QueueTest : public QuickTest {
method SetUp (line 143) | void SetUp() override {
function TEST_F (line 170) | TEST_F(QueueTest, DefaultConstructor) {
function TEST_F (line 175) | TEST_F(QueueTest, Dequeue) {
FILE: test/googletest/samples/sample6_unittest.cc
function PrimeTable (line 47) | PrimeTable* CreatePrimeTable<OnTheFlyPrimeTable>() {
function PrimeTable (line 52) | PrimeTable* CreatePrimeTable<PreCalculatedPrimeTable>() {
class PrimeTableTest (line 58) | class PrimeTableTest : public testing::Test {
method PrimeTableTest (line 62) | PrimeTableTest() : table_(CreatePrimeTable<T>()) {}
function TYPED_TEST (line 99) | TYPED_TEST(PrimeTableTest, ReturnsFalseForNonPrimes) {
function TYPED_TEST (line 115) | TYPED_TEST(PrimeTableTest, ReturnsTrueForPrimes) {
function TYPED_TEST (line 124) | TYPED_TEST(PrimeTableTest, CanGetNextPrime) {
class PrimeTableTest2 (line 160) | class PrimeTableTest2 : public PrimeTableTest<T> {
function TYPED_TEST_P (line 170) | TYPED_TEST_P(PrimeTableTest2, ReturnsFalseForNonPrimes) {
function TYPED_TEST_P (line 179) | TYPED_TEST_P(PrimeTableTest2, ReturnsTrueForPrimes) {
function TYPED_TEST_P (line 188) | TYPED_TEST_P(PrimeTableTest2, CanGetNextPrime) {
FILE: test/googletest/samples/sample7_unittest.cc
function PrimeTable (line 53) | PrimeTable* CreateOnTheFlyPrimeTable() {
function PrimeTable (line 58) | PrimeTable* CreatePreCalculatedPrimeTable() {
class PrimeTableTestSmpl7 (line 66) | class PrimeTableTestSmpl7 : public TestWithParam<CreatePrimeTableFunc*> {
method SetUp (line 69) | void SetUp() override { table_ = (*GetParam())(); }
method TearDown (line 70) | void TearDown() override {
function TEST_P (line 79) | TEST_P(PrimeTableTestSmpl7, ReturnsFalseForNonPrimes) {
function TEST_P (line 88) | TEST_P(PrimeTableTestSmpl7, ReturnsTrueForPrimes) {
function TEST_P (line 97) | TEST_P(PrimeTableTestSmpl7, CanGetNextPrime) {
FILE: test/googletest/samples/sample8_unittest.cc
class HybridPrimeTable (line 48) | class HybridPrimeTable : public PrimeTable {
method HybridPrimeTable (line 50) | HybridPrimeTable(bool force_on_the_fly, int max_precalculated)
method IsPrime (line 61) | bool IsPrime(int n) const override {
method GetNextPrime (line 68) | int GetNextPrime(int p) const override {
class PrimeTableTest (line 92) | class PrimeTableTest : public TestWithParam< ::std::tuple<bool, int> > {
method SetUp (line 94) | void SetUp() override {
method TearDown (line 100) | void TearDown() override {
function TEST_P (line 107) | TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) {
function TEST_P (line 122) | TEST_P(PrimeTableTest, ReturnsTrueForPrimes) {
function TEST_P (line 131) | TEST_P(PrimeTableTest, CanGetNextPrime) {
FILE: test/googletest/samples/sample9_unittest.cc
class TersePrinter (line 49) | class TersePrinter : public EmptyTestEventListener {
method OnTestProgramStart (line 52) | void OnTestProgramStart(const UnitTest& /* unit_test */) override {}
method OnTestProgramEnd (line 55) | void OnTestProgramEnd(const UnitTest& unit_test) override {
method OnTestStart (line 61) | void OnTestStart(const TestInfo& test_info) override {
method OnTestPartResult (line 70) | void OnTestPartResult(const TestPartResult& test_part_result) override {
method OnTestEnd (line 81) | void OnTestEnd(const TestInfo& test_info) override {
function TEST (line 90) | TEST(CustomOutputTest, PrintsMessage) {
function TEST (line 94) | TEST(CustomOutputTest, Succeeds) {
function TEST (line 98) | TEST(CustomOutputTest, Fails) {
function main (line 104) | int main(int argc, char **argv) {
FILE: test/googletest/scripts/common.py
function GetCommandOutput (line 46) | def GetCommandOutput(command):
function GetSvnInfo (line 55) | def GetSvnInfo():
function GetSvnTrunk (line 69) | def GetSvnTrunk():
function IsInGTestSvn (line 76) | def IsInGTestSvn():
function IsInGMockSvn (line 81) | def IsInGMockSvn():
FILE: test/googletest/scripts/fuse_gtest_files.py
function VerifyFileExists (line 89) | def VerifyFileExists(directory, relative_path):
function ValidateGTestRootDir (line 103) | def ValidateGTestRootDir(gtest_root):
function VerifyOutputFile (line 113) | def VerifyOutputFile(output_dir, relative_path):
function ValidateOutputDir (line 139) | def ValidateOutputDir(output_dir):
function FuseGTestH (line 149) | def FuseGTestH(gtest_root, output_dir):
function FuseGTestAllCcToFile (line 178) | def FuseGTestAllCcToFile(gtest_root, output_file):
function FuseGTestAllCc (line 221) | def FuseGTestAllCc(gtest_root, output_dir):
function FuseGTest (line 229) | def FuseGTest(gtest_root, output_dir):
function main (line 239) | def main():
FILE: test/googletest/scripts/gen_gtest_pred_impl.py
function HeaderPreamble (line 65) | def HeaderPreamble(n):
function Arity (line 165) | def Arity(n):
function Title (line 176) | def Title(word):
function OneTo (line 184) | def OneTo(n):
function Iter (line 190) | def Iter(n, format, sep=''):
function ImplementationForArity (line 206) | def ImplementationForArity(n):
function HeaderPostamble (line 296) | def HeaderPostamble():
function GenerateFile (line 307) | def GenerateFile(path, content):
function GenerateHeader (line 319) | def GenerateHeader(n):
function UnitTestPreamble (line 329) | def UnitTestPreamble():
function TestsForArity (line 415) | def TestsForArity(n):
function UnitTestPostamble (line 704) | def UnitTestPostamble():
function GenerateUnitTest (line 710) | def GenerateUnitTest(n):
function _Main (line 719) | def _Main():
FILE: test/googletest/scripts/release_docs.py
function DropWikiSuffix (line 82) | def DropWikiSuffix(wiki_filename):
class WikiBrancher (line 89) | class WikiBrancher(object):
method __init__ (line 92) | def __init__(self, dot_version):
method GetFilesToBranch (line 117) | def GetFilesToBranch(self):
method BranchFiles (line 127) | def BranchFiles(self):
method UpdateLinksInBranchedFiles (line 137) | def UpdateLinksInBranchedFiles(self):
function main (line 148) | def main():
FILE: test/googletest/scripts/run_with_path.py
function main (line 17) | def main():
FILE: test/googletest/scripts/upload.py
function GetEmail (line 80) | def GetEmail(prompt):
function StatusUpdate (line 112) | def StatusUpdate(msg):
function ErrorExit (line 124) | def ErrorExit(msg):
class ClientLoginError (line 130) | class ClientLoginError(urllib2.HTTPError):
method __init__ (line 133) | def __init__(self, url, code, msg, headers, args):
class AbstractRpcServer (line 139) | class AbstractRpcServer(object):
method __init__ (line 142) | def __init__(self, host, auth_function, host_override=None, extra_head...
method _GetOpener (line 169) | def _GetOpener(self):
method _CreateRequest (line 177) | def _CreateRequest(self, url, data=None):
method _GetAuthToken (line 187) | def _GetAuthToken(self, email, password):
method _GetAuthCookie (line 230) | def _GetAuthCookie(self, auth_token):
method _Authenticate (line 254) | def _Authenticate(self):
method Send (line 306) | def Send(self, request_path, payload=None,
class HttpRpcServer (line 359) | class HttpRpcServer(AbstractRpcServer):
method _Authenticate (line 362) | def _Authenticate(self):
method _GetOpener (line 369) | def _GetOpener(self):
function GetRpcServer (line 473) | def GetRpcServer(options):
function EncodeMultipartFormData (line 513) | def EncodeMultipartFormData(fields, files):
function GetContentType (line 548) | def GetContentType(filename):
function RunShellWithReturnCode (line 556) | def RunShellWithReturnCode(command, print_output=False,
function RunShell (line 592) | def RunShell(command, silent_ok=False, universal_newlines=True,
class VersionControlSystem (line 603) | class VersionControlSystem(object):
method __init__ (line 606) | def __init__(self, options):
method GenerateDiff (line 614) | def GenerateDiff(self, args):
method GetUnknownFiles (line 623) | def GetUnknownFiles(self):
method CheckForUnknownFiles (line 628) | def CheckForUnknownFiles(self):
method GetBaseFile (line 640) | def GetBaseFile(self, filename):
method GetBaseFiles (line 657) | def GetBaseFiles(self, diff):
method UploadBaseFiles (line 676) | def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, opt...
method IsImage (line 728) | def IsImage(self, filename):
class SubversionVCS (line 736) | class SubversionVCS(VersionControlSystem):
method __init__ (line 739) | def __init__(self, options):
method GuessBase (line 757) | def GuessBase(self, required):
method _GuessBase (line 761) | def _GuessBase(self, required):
method GenerateDiff (line 805) | def GenerateDiff(self, args):
method _CollapseKeywords (line 820) | def _CollapseKeywords(self, content, keyword_str):
method GetUnknownFiles (line 851) | def GetUnknownFiles(self):
method ReadFile (line 859) | def ReadFile(self, filename):
method GetStatus (line 869) | def GetStatus(self, filename):
method GetBaseFile (line 913) | def GetBaseFile(self, filename):
class GitVCS (line 1000) | class GitVCS(VersionControlSystem):
method __init__ (line 1003) | def __init__(self, options):
method GenerateDiff (line 1008) | def GenerateDiff(self, extra_args):
method GetUnknownFiles (line 1036) | def GetUnknownFiles(self):
method GetBaseFile (line 1041) | def GetBaseFile(self, filename):
class MercurialVCS (line 1057) | class MercurialVCS(VersionControlSystem):
method __init__ (line 1060) | def __init__(self, options, repo_dir):
method _GetRelPath (line 1073) | def _GetRelPath(self, filename):
method GenerateDiff (line 1079) | def GenerateDiff(self, extra_args):
method GetUnknownFiles (line 1105) | def GetUnknownFiles(self):
method GetBaseFile (line 1117) | def GetBaseFile(self, filename):
function SplitPatch (line 1156) | def SplitPatch(data):
function UploadSeparatePatches (line 1196) | def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
function GuessVCS (line 1224) | def GuessVCS(options):
function RealMain (line 1265) | def RealMain(argv, data=None):
function main (line 1392) | def main():
FILE: test/googletest/scripts/upload_gtest.py
function main (line 49) | def main():
FILE: test/googletest/src/gtest-death-test.cc
type testing (line 87) | namespace testing {
type internal (line 119) | namespace internal {
function InDeathTestChild (line 145) | bool InDeathTestChild() {
function ExitSummary (line 205) | static std::string ExitSummary(int exit_code) {
function ExitedUnsuccessfully (line 231) | bool ExitedUnsuccessfully(int exit_status) {
function DeathTestThreadWarning (line 240) | static std::string DeathTestThreadWarning(size_t thread_count) {
type DeathTestOutcome (line 278) | enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW }
function DeathTestAbort (line 285) | static void DeathTestAbort(const std::string& message) {
function GetLastErrnoDescription (line 338) | std::string GetLastErrnoDescription() {
function FailFromInternalError (line 346) | static void FailFromInternalError(int fd) {
class DeathTestImpl (line 397) | class DeathTestImpl : public DeathTest {
method DeathTestImpl (line 399) | DeathTestImpl(const char* a_statement, Matcher<const std::string&>...
method spawned (line 415) | bool spawned() const { return spawned_; }
method set_spawned (line 416) | void set_spawned(bool is_spawned) { spawned_ = is_spawned; }
method status (line 417) | int status() const { return status_; }
method set_status (line 418) | void set_status(int a_status) { status_ = a_status; }
method DeathTestOutcome (line 419) | DeathTestOutcome outcome() const { return outcome_; }
method set_outcome (line 420) | void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outc...
method read_fd (line 421) | int read_fd() const { return read_fd_; }
method set_read_fd (line 422) | void set_read_fd(int fd) { read_fd_ = fd; }
method write_fd (line 423) | int write_fd() const { return write_fd_; }
method set_write_fd (line 424) | void set_write_fd(int fd) { write_fd_ = fd; }
function FormatDeathTestOutput (line 533) | static ::std::string FormatDeathTestOutput(const ::std::string& outp...
class WindowsDeathTest (line 649) | class WindowsDeathTest : public DeathTestImpl {
method WindowsDeathTest (line 651) | WindowsDeathTest(const char* a_statement, Matcher<const std::strin...
class FuchsiaDeathTest (line 813) | class FuchsiaDeathTest : public DeathTestImpl {
method FuchsiaDeathTest (line 815) | FuchsiaDeathTest(const char* a_statement, Matcher<const std::strin...
class Arguments (line 840) | class Arguments {
method Arguments (line 842) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 850) | void AddArgument(const char* argument) {
method AddArguments (line 855) | void AddArguments(const ::std::vector<Str>& arguments) {
method size (line 866) | int size() {
method Arguments (line 1193) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 1201) | void AddArgument(const char* argument) {
method AddArguments (line 1206) | void AddArguments(const ::std::vector<Str>& arguments) {
class ForkingDeathTest (line 1073) | class ForkingDeathTest : public DeathTestImpl {
method set_child_pid (line 1081) | void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
class NoExecDeathTest (line 1110) | class NoExecDeathTest : public ForkingDeathTest {
method NoExecDeathTest (line 1112) | NoExecDeathTest(const char* a_statement, Matcher<const std::string...
class ExecDeathTest (line 1165) | class ExecDeathTest : public ForkingDeathTest {
method ExecDeathTest (line 1167) | ExecDeathTest(const char* a_statement, Matcher<const std::string&>...
method GetArgvsForDeathTestChildProcess (line 1175) | static ::std::vector<std::string> GetArgvsForDeathTestChildProcess...
class Arguments (line 1191) | class Arguments {
method Arguments (line 842) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 850) | void AddArgument(const char* argument) {
method AddArguments (line 855) | void AddArguments(const ::std::vector<Str>& arguments) {
method size (line 866) | int size() {
method Arguments (line 1193) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 1201) | void AddArgument(const char* argument) {
method AddArguments (line 1206) | void AddArguments(const ::std::vector<Str>& arguments) {
type ExecDeathTestArgs (line 1223) | struct ExecDeathTestArgs {
function ExecDeathTestChildMain (line 1246) | static int ExecDeathTestChildMain(void* child_arg) {
function GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ (line 1289) | GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
function GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ (line 1296) | GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
function pid_t (line 1313) | static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
type internal (line 132) | namespace internal {
function InDeathTestChild (line 145) | bool InDeathTestChild() {
function ExitSummary (line 205) | static std::string ExitSummary(int exit_code) {
function ExitedUnsuccessfully (line 231) | bool ExitedUnsuccessfully(int exit_status) {
function DeathTestThreadWarning (line 240) | static std::string DeathTestThreadWarning(size_t thread_count) {
type DeathTestOutcome (line 278) | enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW }
function DeathTestAbort (line 285) | static void DeathTestAbort(const std::string& message) {
function GetLastErrnoDescription (line 338) | std::string GetLastErrnoDescription() {
function FailFromInternalError (line 346) | static void FailFromInternalError(int fd) {
class DeathTestImpl (line 397) | class DeathTestImpl : public DeathTest {
method DeathTestImpl (line 399) | DeathTestImpl(const char* a_statement, Matcher<const std::string&>...
method spawned (line 415) | bool spawned() const { return spawned_; }
method set_spawned (line 416) | void set_spawned(bool is_spawned) { spawned_ = is_spawned; }
method status (line 417) | int status() const { return status_; }
method set_status (line 418) | void set_status(int a_status) { status_ = a_status; }
method DeathTestOutcome (line 419) | DeathTestOutcome outcome() const { return outcome_; }
method set_outcome (line 420) | void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outc...
method read_fd (line 421) | int read_fd() const { return read_fd_; }
method set_read_fd (line 422) | void set_read_fd(int fd) { read_fd_ = fd; }
method write_fd (line 423) | int write_fd() const { return write_fd_; }
method set_write_fd (line 424) | void set_write_fd(int fd) { write_fd_ = fd; }
function FormatDeathTestOutput (line 533) | static ::std::string FormatDeathTestOutput(const ::std::string& outp...
class WindowsDeathTest (line 649) | class WindowsDeathTest : public DeathTestImpl {
method WindowsDeathTest (line 651) | WindowsDeathTest(const char* a_statement, Matcher<const std::strin...
class FuchsiaDeathTest (line 813) | class FuchsiaDeathTest : public DeathTestImpl {
method FuchsiaDeathTest (line 815) | FuchsiaDeathTest(const char* a_statement, Matcher<const std::strin...
class Arguments (line 840) | class Arguments {
method Arguments (line 842) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 850) | void AddArgument(const char* argument) {
method AddArguments (line 855) | void AddArguments(const ::std::vector<Str>& arguments) {
method size (line 866) | int size() {
method Arguments (line 1193) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 1201) | void AddArgument(const char* argument) {
method AddArguments (line 1206) | void AddArguments(const ::std::vector<Str>& arguments) {
class ForkingDeathTest (line 1073) | class ForkingDeathTest : public DeathTestImpl {
method set_child_pid (line 1081) | void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
class NoExecDeathTest (line 1110) | class NoExecDeathTest : public ForkingDeathTest {
method NoExecDeathTest (line 1112) | NoExecDeathTest(const char* a_statement, Matcher<const std::string...
class ExecDeathTest (line 1165) | class ExecDeathTest : public ForkingDeathTest {
method ExecDeathTest (line 1167) | ExecDeathTest(const char* a_statement, Matcher<const std::string&>...
method GetArgvsForDeathTestChildProcess (line 1175) | static ::std::vector<std::string> GetArgvsForDeathTestChildProcess...
class Arguments (line 1191) | class Arguments {
method Arguments (line 842) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 850) | void AddArgument(const char* argument) {
method AddArguments (line 855) | void AddArguments(const ::std::vector<Str>& arguments) {
method size (line 866) | int size() {
method Arguments (line 1193) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 1201) | void AddArgument(const char* argument) {
method AddArguments (line 1206) | void AddArguments(const ::std::vector<Str>& arguments) {
type ExecDeathTestArgs (line 1223) | struct ExecDeathTestArgs {
function ExecDeathTestChildMain (line 1246) | static int ExecDeathTestChildMain(void* child_arg) {
function GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ (line 1289) | GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
function GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ (line 1296) | GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
function pid_t (line 1313) | static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
type internal (line 199) | namespace internal {
function InDeathTestChild (line 145) | bool InDeathTestChild() {
function ExitSummary (line 205) | static std::string ExitSummary(int exit_code) {
function ExitedUnsuccessfully (line 231) | bool ExitedUnsuccessfully(int exit_status) {
function DeathTestThreadWarning (line 240) | static std::string DeathTestThreadWarning(size_t thread_count) {
type DeathTestOutcome (line 278) | enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW }
function DeathTestAbort (line 285) | static void DeathTestAbort(const std::string& message) {
function GetLastErrnoDescription (line 338) | std::string GetLastErrnoDescription() {
function FailFromInternalError (line 346) | static void FailFromInternalError(int fd) {
class DeathTestImpl (line 397) | class DeathTestImpl : public DeathTest {
method DeathTestImpl (line 399) | DeathTestImpl(const char* a_statement, Matcher<const std::string&>...
method spawned (line 415) | bool spawned() const { return spawned_; }
method set_spawned (line 416) | void set_spawned(bool is_spawned) { spawned_ = is_spawned; }
method status (line 417) | int status() const { return status_; }
method set_status (line 418) | void set_status(int a_status) { status_ = a_status; }
method DeathTestOutcome (line 419) | DeathTestOutcome outcome() const { return outcome_; }
method set_outcome (line 420) | void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outc...
method read_fd (line 421) | int read_fd() const { return read_fd_; }
method set_read_fd (line 422) | void set_read_fd(int fd) { read_fd_ = fd; }
method write_fd (line 423) | int write_fd() const { return write_fd_; }
method set_write_fd (line 424) | void set_write_fd(int fd) { write_fd_ = fd; }
function FormatDeathTestOutput (line 533) | static ::std::string FormatDeathTestOutput(const ::std::string& outp...
class WindowsDeathTest (line 649) | class WindowsDeathTest : public DeathTestImpl {
method WindowsDeathTest (line 651) | WindowsDeathTest(const char* a_statement, Matcher<const std::strin...
class FuchsiaDeathTest (line 813) | class FuchsiaDeathTest : public DeathTestImpl {
method FuchsiaDeathTest (line 815) | FuchsiaDeathTest(const char* a_statement, Matcher<const std::strin...
class Arguments (line 840) | class Arguments {
method Arguments (line 842) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 850) | void AddArgument(const char* argument) {
method AddArguments (line 855) | void AddArguments(const ::std::vector<Str>& arguments) {
method size (line 866) | int size() {
method Arguments (line 1193) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 1201) | void AddArgument(const char* argument) {
method AddArguments (line 1206) | void AddArguments(const ::std::vector<Str>& arguments) {
class ForkingDeathTest (line 1073) | class ForkingDeathTest : public DeathTestImpl {
method set_child_pid (line 1081) | void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
class NoExecDeathTest (line 1110) | class NoExecDeathTest : public ForkingDeathTest {
method NoExecDeathTest (line 1112) | NoExecDeathTest(const char* a_statement, Matcher<const std::string...
class ExecDeathTest (line 1165) | class ExecDeathTest : public ForkingDeathTest {
method ExecDeathTest (line 1167) | ExecDeathTest(const char* a_statement, Matcher<const std::string&>...
method GetArgvsForDeathTestChildProcess (line 1175) | static ::std::vector<std::string> GetArgvsForDeathTestChildProcess...
class Arguments (line 1191) | class Arguments {
method Arguments (line 842) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 850) | void AddArgument(const char* argument) {
method AddArguments (line 855) | void AddArguments(const ::std::vector<Str>& arguments) {
method size (line 866) | int size() {
method Arguments (line 1193) | Arguments() { args_.push_back(nullptr); }
method AddArgument (line 1201) | void AddArgument(const char* argument) {
method AddArguments (line 1206) | void AddArguments(const ::std::vector<Str>& arguments) {
type ExecDeathTestArgs (line 1223) | struct ExecDeathTestArgs {
function ExecDeathTestChildMain (line 1246) | static int ExecDeathTestChildMain(void* child_arg) {
function GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ (line 1289) | GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
function GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ (line 1296) | GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
function pid_t (line 1313) | static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
function GetStatusFileDescriptor (line 1530) | static int GetStatusFileDescriptor(unsigned int parent_process_id,
function InternalRunDeathTestFlag (line 1595) | InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
FILE: test/googletest/src/gtest-filepath.cc
type testing (line 58) | namespace testing {
type internal (line 59) | namespace internal {
function IsPathSeparator (line 85) | static bool IsPathSeparator(char c) {
function FilePath (line 94) | FilePath FilePath::GetCurrentDir() {
function FilePath (line 120) | FilePath FilePath::RemoveExtension(const char* extension) const {
function FilePath (line 151) | FilePath FilePath::RemoveDirectoryName() const {
function FilePath (line 162) | FilePath FilePath::RemoveFileName() const {
function FilePath (line 179) | FilePath FilePath::MakeFileName(const FilePath& directory,
function FilePath (line 195) | FilePath FilePath::ConcatPaths(const FilePath& directory,
function FilePath (line 279) | FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
function FilePath (line 342) | FilePath FilePath::RemoveTrailingPathSeparator() const {
FILE: test/googletest/src/gtest-internal-inl.h
function namespace (line 66) | namespace testing {
FILE: test/googletest/src/gtest-matchers.cc
type testing (line 41) | namespace testing {
FILE: test/googletest/src/gtest-port.cc
type testing (line 88) | namespace testing {
type internal (line 89) | namespace internal {
function T (line 104) | T ReadProcFileField(const std::string& filename, int field) {
function GetThreadCount (line 117) | size_t GetThreadCount() {
function GetThreadCount (line 125) | size_t GetThreadCount() {
function GetThreadCount (line 161) | size_t GetThreadCount() {
function GetThreadCount (line 184) | size_t GetThreadCount() {
function GetThreadCount (line 221) | size_t GetThreadCount() {
function GetThreadCount (line 239) | size_t GetThreadCount() {
function GetThreadCount (line 252) | size_t GetThreadCount() {
function GetThreadCount (line 271) | size_t GetThreadCount() {
function SleepMilliseconds (line 281) | void SleepMilliseconds(int n) {
class MemoryIsNotDeallocated (line 392) | class MemoryIsNotDeallocated
method MemoryIsNotDeallocated (line 395) | MemoryIsNotDeallocated() : old_crtdbg_flag_(0) {
class ThreadWithParamSupport (line 465) | class ThreadWithParamSupport : public ThreadWithParamBase {
method HANDLE (line 467) | static HANDLE CreateThread(Runnable* runnable,
type ThreadMainParam (line 487) | struct ThreadMainParam {
method ThreadMainParam (line 488) | ThreadMainParam(Runnable* runnable, Notification* thread_can_start)
method DWORD (line 497) | static DWORD WINAPI ThreadMain(void* ptr) {
class ThreadLocalRegistryImpl (line 533) | class ThreadLocalRegistryImpl {
method ThreadLocalValueHolderBase (line 537) | static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
method OnThreadLocalDestroyed (line 565) | static void OnThreadLocalDestroyed(
method OnThreadExit (line 593) | static void OnThreadExit(DWORD thread_id) {
method StartWatcherThreadFor (line 632) | static void StartWatcherThreadFor(DWORD thread_id) {
method DWORD (line 659) | static DWORD WINAPI WatcherThreadFunc(LPVOID param) {
method ThreadIdToThreadLocals (line 671) | static ThreadIdToThreadLocals* GetThreadLocalsMapLocked() {
function ThreadLocalValueHolderBase (line 689) | ThreadLocalValueHolderBase* ThreadLocalRegistry::GetValueOnCurrentTh...
function IsInSet (line 769) | bool IsInSet(char ch, const char* str) {
function IsAsciiDigit (line 776) | bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; }
function IsAsciiPunct (line 777) | bool IsAsciiPunct(char ch) {
function IsRepeat (line 780) | bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); }
function IsAsciiWhiteSpace (line 781) | bool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); }
function IsAsciiWordChar (line 782) | bool IsAsciiWordChar(char ch) {
function IsValidEscape (line 788) | bool IsValidEscape(char c) {
function AtomMatchesChar (line 794) | bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
function FormatRegexSyntaxError (line 816) | static std::string FormatRegexSyntaxError(const char* regex, int ind...
function ValidateRegex (line 823) | bool ValidateRegex(const char* regex) {
function MatchRepetitionAndRegexAtHead (line 883) | bool MatchRepetitionAndRegexAtHead(
function MatchRegexAtHead (line 910) | bool MatchRegexAtHead(const char* regex, const char* str) {
function MatchRegexAnywhere (line 946) | bool MatchRegexAnywhere(const char* regex, const char* str) {
function FormatFileLocation (line 1018) | GTEST_API_ ::std::string FormatFileLocation(const char* file, int li...
function FormatCompilerIndependentFileLocation (line 1036) | GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(
class CapturedStream (line 1072) | class CapturedStream {
method CapturedStream (line 1075) | explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
method GetCapturedString (line 1129) | std::string GetCapturedString() {
function CaptureStream (line 1163) | static void CaptureStream(int fd, const char* stream_name,
function GetCapturedStream (line 1173) | static std::string GetCapturedStream(CapturedStream** captured_strea...
function CaptureStdout (line 1183) | void CaptureStdout() {
function CaptureStderr (line 1188) | void CaptureStderr() {
function GetCapturedStdout (line 1193) | std::string GetCapturedStdout() {
function GetCapturedStderr (line 1198) | std::string GetCapturedStderr() {
function GetFileSize (line 1208) | size_t GetFileSize(FILE* file) {
function ReadEntireFile (line 1213) | std::string ReadEntireFile(FILE* file) {
function GetInjectableArgvs (line 1239) | std::vector<std::string> GetInjectableArgvs() {
function SetInjectableArgvs (line 1246) | void SetInjectableArgvs(const std::vector<std::string>* new_argvs) {
function SetInjectableArgvs (line 1251) | void SetInjectableArgvs(const std::vector<std::string>& new_argvs) {
function ClearInjectableArgvs (line 1256) | void ClearInjectableArgvs() {
type posix (line 1263) | namespace posix {
function Abort (line 1264) | void Abort() {
function FlagToEnvVar (line 1274) | static std::string FlagToEnvVar(const char* flag) {
function ParseInt32 (line 1289) | bool ParseInt32(const Message& src_text, const char* str, Int32* val...
function BoolFromGTestEnv (line 1331) | bool BoolFromGTestEnv(const char* flag, bool default_value) {
function Int32 (line 1345) | Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) {
function OutputFlagAlsoCheckEnvVar (line 1377) | std::string OutputFlagAlsoCheckEnvVar(){
FILE: test/googletest/src/gtest-printers.cc
type testing (line 53) | namespace testing {
function GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ (line 60) | GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
function PrintBytesInObjectToImpl (line 83) | void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t c...
type internal2 (line 107) | namespace internal2 {
function PrintBytesInObjectTo (line 114) | void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count,
type internal (line 121) | namespace internal {
type CharFormat (line 128) | enum CharFormat {
function IsPrintableAscii (line 137) | inline bool IsPrintableAscii(wchar_t c) {
function CharFormat (line 146) | static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
function CharFormat (line 196) | static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) {
function CharFormat (line 211) | static CharFormat PrintAsStringLiteralTo(char c, ostream* os) {
function PrintCharAndCodeTo (line 221) | void PrintCharAndCodeTo(Char c, ostream* os) {
function PrintTo (line 245) | void PrintTo(unsigned char c, ::std::ostream* os) {
function PrintTo (line 248) | void PrintTo(signed char c, ::std::ostream* os) {
function PrintTo (line 254) | void PrintTo(wchar_t wc, ostream* os) {
function CharFormat (line 267) | static CharFormat PrintCharsAsStringTo(
function UniversalPrintCharArray (line 298) | static void UniversalPrintCharArray(
function UniversalPrintArray (line 321) | void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
function UniversalPrintArray (line 327) | void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* ...
function PrintTo (line 332) | void PrintTo(const char* s, ostream* os) {
function PrintTo (line 349) | void PrintTo(const wchar_t* s, ostream* os) {
function ContainsUnprintableControlCodes (line 361) | bool ContainsUnprintableControlCodes(const char* str, size_t length) {
function IsUTF8TrailByte (line 380) | bool IsUTF8TrailByte(unsigned char t) { return 0x80 <= t && t<= 0xbf; }
function IsValidUTF8 (line 382) | bool IsValidUTF8(const char* str, size_t length) {
function ConditionalPrintAsText (line 417) | void ConditionalPrintAsText(const char* str, size_t length, ostream*...
function PrintStringTo (line 426) | void PrintStringTo(const ::std::string& s, ostream* os) {
function PrintWideStringTo (line 435) | void PrintWideStringTo(const ::std::wstring& s, ostream* os) {
FILE: test/googletest/src/gtest-test-part.cc
type testing (line 38) | namespace testing {
function TestPartResult (line 71) | const TestPartResult& TestPartResultArray::GetTestPartResult(int index...
type internal (line 85) | namespace internal {
FILE: test/googletest/src/gtest-typed-test.cc
type testing (line 35) | namespace testing {
type internal (line 36) | namespace internal {
function SplitIntoTestNames (line 48) | static std::vector<std::string> SplitIntoTestNames(const char* src) {
FILE: test/googletest/src/gtest.cc
type testing (line 144) | namespace testing {
type internal (line 177) | namespace internal {
function FILE (line 188) | static FILE* OpenFileForWriting(const std::string& output_file) {
function UInt32 (line 336) | UInt32 Random::Generate(UInt32 range) {
function GTestIsInitialized (line 356) | static bool GTestIsInitialized() { return GetArgvs().size() > 0; }
function SumOverTestSuiteList (line 361) | static int SumOverTestSuiteList(const std::vector<TestSuite*>& case_...
function TestSuitePassed (line 371) | static bool TestSuitePassed(const TestSuite* test_suite) {
function TestSuiteFailed (line 376) | static bool TestSuiteFailed(const TestSuite* test_suite) {
function ShouldRunTestSuite (line 382) | static bool ShouldRunTestSuite(const TestSuite* test_suite) {
function GetArgvs (line 412) | ::std::vector<std::string> GetArgvs() {
function FilePath (line 425) | FilePath GetCurrentExecutableName() {
function TypeId (line 644) | TypeId GetTestTypeId() {
function AssertionResult (line 655) | static AssertionResult HasOneFailure(const char* /* results_expr */,
function TestPartResultReporterInterface (line 725) | TestPartResultReporterInterface*
function TestPartResultReporterInterface (line 739) | TestPartResultReporterInterface*
function TimeInMillis (line 832) | TimeInMillis GetTimeInMillis() {
function LPCWSTR (line 880) | LPCWSTR String::AnsiToUtf16(const char* ansi) {
function StreamWideCharsToMessage (line 927) | static void StreamWideCharsToMessage(const wchar_t* wstr, size_t len...
function SplitString (line 943) | void SplitString(const ::std::string& str, char delimiter,
type edit_distance (line 1037) | namespace edit_distance {
function CalculateOptimalEdits (line 1038) | std::vector<EditType> CalculateOptimalEdits(const std::vector<size...
class InternalStrings (line 1098) | class InternalStrings {
method GetId (line 1100) | size_t GetId(const std::string& str) {
function CalculateOptimalEdits (line 1114) | std::vector<EditType> CalculateOptimalEdits(
class Hunk (line 1136) | class Hunk {
method Hunk (line 1138) | Hunk(size_t left_start, size_t right_start)
method PushLine (line 1145) | void PushLine(char edit, const char* line) {
method PrintTo (line 1163) | void PrintTo(std::ostream* os) {
method has_edits (line 1173) | bool has_edits() const { return adds_ || removes_; }
method FlushEdits (line 1176) | void FlushEdits() {
method PrintHeader (line 1185) | void PrintHeader(std::ostream* ss) const {
function CreateUnifiedDiff (line 1213) | std::string CreateUnifiedDiff(const std::vector<std::string>& left,
function SplitEscapedString (line 1283) | std::vector<std::string> SplitEscapedString(const std::string& str) {
function AssertionResult (line 1323) | AssertionResult EqFailure(const char* lhs_expression,
function GetBoolAssertionFailureMessage (line 1358) | std::string GetBoolAssertionFailureMessage(
function AssertionResult (line 1374) | AssertionResult DoubleNearPredFormat(const char* expr1,
function AssertionResult (line 1394) | AssertionResult FloatingPointLE(const char* expr1,
function AssertionResult (line 1447) | AssertionResult CmpHelperEQ(const char* lhs_expression,
type internal (line 331) | namespace internal {
function FILE (line 188) | static FILE* OpenFileForWriting(const std::string& output_file) {
function UInt32 (line 336) | UInt32 Random::Generate(UInt32 range) {
function GTestIsInitialized (line 356) | static bool GTestIsInitialized() { return GetArgvs().size() > 0; }
function SumOverTestSuiteList (line 361) | static int SumOverTestSuiteList(const std::vector<TestSuite*>& case_...
function TestSuitePassed (line 371) | static bool TestSuitePassed(const TestSuite* test_suite) {
function TestSuiteFailed (line 376) | static bool TestSuiteFailed(const TestSuite* test_suite) {
function ShouldRunTestSuite (line 382) | static bool ShouldRunTestSuite(const TestSuite* test_suite) {
function GetArgvs (line 412) | ::std::vector<std::string> GetArgvs() {
function FilePath (line 425) | FilePath GetCurrentExecutableName() {
function TypeId (line 644) | TypeId GetTestTypeId() {
function AssertionResult (line 655) | static AssertionResult HasOneFailure(const char* /* results_expr */,
function TestPartResultReporterInterface (line 725) | TestPartResultReporterInterface*
function TestPartResultReporterInterface (line 739) | TestPartResultReporterInterface*
function TimeInMillis (line 832) | TimeInMillis GetTimeInMillis() {
function LPCWSTR (line 880) | LPCWSTR String::AnsiToUtf16(const char* ansi) {
function StreamWideCharsToMessage (line 927) | static void StreamWideCharsToMessage(const wchar_t* wstr, size_t len...
function SplitString (line 943) | void SplitString(const ::std::string& str, char delimiter,
type edit_distance (line 1037) | namespace edit_distance {
function CalculateOptimalEdits (line 1038) | std::vector<EditType> CalculateOptimalEdits(const std::vector<size...
class InternalStrings (line 1098) | class InternalStrings {
method GetId (line 1100) | size_t GetId(const std::string& str) {
function CalculateOptimalEdits (line 1114) | std::vector<EditType> CalculateOptimalEdits(
class Hunk (line 1136) | class Hunk {
method Hunk (line 1138) | Hunk(size_t left_start, size_t right_start)
method PushLine (line 1145) | void PushLine(char edit, const char* line) {
method PrintTo (line 1163) | void PrintTo(std::ostream* os) {
method has_edits (line 1173) | bool has_edits() const { return adds_ || removes_; }
method FlushEdits (line 1176) | void FlushEdits() {
method PrintHeader (line 1185) | void PrintHeader(std::ostream* ss) const {
function CreateUnifiedDiff (line 1213) | std::string CreateUnifiedDiff(const std::vector<std::string>& left,
function SplitEscapedString (line 1283) | std::vector<std::string> SplitEscapedString(const std::string& str) {
function AssertionResult (line 1323) | AssertionResult EqFailure(const char* lhs_expression,
function GetBoolAssertionFailureMessage (line 1358) | std::string GetBoolAssertionFailureMessage(
function AssertionResult (line 1374) | AssertionResult DoubleNearPredFormat(const char* expr1,
function AssertionResult (line 1394) | AssertionResult FloatingPointLE(const char* expr1,
function AssertionResult (line 1447) | AssertionResult CmpHelperEQ(const char* lhs_expression,
type internal (line 633) | namespace internal {
function FILE (line 188) | static FILE* OpenFileForWriting(const std::string& output_file) {
function UInt32 (line 336) | UInt32 Random::Generate(UInt32 range) {
function GTestIsInitialized (line 356) | static bool GTestIsInitialized() { return GetArgvs().size() > 0; }
function SumOverTestSuiteList (line 361) | static int SumOverTestSuiteList(const std::vector<TestSuite*>& case_...
function TestSuitePassed (line 371) | static bool TestSuitePassed(const TestSuite* test_suite) {
function TestSuiteFailed (line 376) | static bool TestSuiteFailed(const TestSuite* test_suite) {
function ShouldRunTestSuite (line 382) | static bool ShouldRunTestSuite(const TestSuite* test_suite) {
function GetArgvs (line 412) | ::std::vector<std::string> GetArgvs() {
function FilePath (line 425) | FilePath GetCurrentExecutableName() {
function TypeId (line 644) | TypeId GetTestTypeId() {
function AssertionResult (line 655) | static AssertionResult HasOneFailure(const char* /* results_expr */,
function TestPartResultReporterInterface (line 725) | TestPartResultReporterInterface*
function TestPartResultReporterInterface (line 739) | TestPartResultReporterInterface*
function TimeInMillis (line 832) | TimeInMillis GetTimeInMillis() {
function LPCWSTR (line 880) | LPCWSTR String::AnsiToUtf16(const char* ansi) {
function StreamWideCharsToMessage (line 927) | static void StreamWideCharsToMessage(const wchar_t* wstr, size_t len...
function SplitString (line 943) | void SplitString(const ::std::string& str, char delimiter,
type edit_distance (line 1037) | namespace edit_distance {
function CalculateOptimalEdits (line 1038) | std::vector<EditType> CalculateOptimalEdits(const std::vector<size...
class InternalStrings (line 1098) | class InternalStrings {
method GetId (line 1100) | size_t GetId(const std::string& str) {
function CalculateOptimalEdits (line 1114) | std::vector<EditType> CalculateOptimalEdits(
class Hunk (line 1136) | class Hunk {
method Hunk (line 1138) | Hunk(size_t left_start, size_t right_start)
method PushLine (line 1145) | void PushLine(char edit, const char* line) {
method PrintTo (line 1163) | void PrintTo(std::ostream* os) {
method has_edits (line 1173) | bool has_edits() const { return adds_ || removes_; }
method FlushEdits (line 1176) | void FlushEdits() {
method PrintHeader (line 1185) | void PrintHeader(std::ostream* ss) const {
function CreateUnifiedDiff (line 1213) | std::string CreateUnifiedDiff(const std::vector<std::string>& left,
function SplitEscapedString (line 1283) | std::vector<std::string> SplitEscapedString(const std::string& str) {
function AssertionResult (line 1323) | AssertionResult EqFailure(const char* lhs_expression,
function GetBoolAssertionFailureMessage (line 1358) | std::string GetBoolAssertionFailureMessage(
function AssertionResult (line 1374) | AssertionResult DoubleNearPredFormat(const char* expr1,
function AssertionResult (line 1394) | AssertionResult FloatingPointLE(const char* expr1,
function AssertionResult (line 1447) | AssertionResult CmpHelperEQ(const char* lhs_expression,
function Message (line 975) | Message& Message::operator <<(const wchar_t* wide_c_str) {
function Message (line 978) | Message& Message::operator <<(wchar_t* wide_c_str) {
function Message (line 985) | Message& Message::operator <<(const ::std::wstring& wstr) {
function AssertionResult (line 1013) | AssertionResult AssertionResult::operator!() const {
function AssertionResult (line 1020) | AssertionResult AssertionSuccess() {
function AssertionResult (line 1025) | AssertionResult AssertionFailure() {
function AssertionResult (line 1031) | AssertionResult AssertionFailure(const Message& message) {
type internal (line 1035) | namespace internal {
function FILE (line 188) | static FILE* OpenFileForWriting(const std::string& output_file) {
function UInt32 (line 336) | UInt32 Random::Generate(UInt32 range) {
function GTestIsInitialized (line 356) | static bool GTestIsInitialized() { return GetArgvs().size() > 0; }
function SumOverTestSuiteList (line 361) | static int SumOverTestSuiteList(const std::vector<TestSuite*>& case_...
function TestSuitePassed (line 371) | static bool TestSuitePassed(const TestSuite* test_suite) {
function TestSuiteFailed (line 376) | static bool TestSuiteFailed(const TestSuite* test_suite) {
function ShouldRunTestSuite (line 382) | static bool ShouldRunTestSuite(const TestSuite* test_suite) {
function GetArgvs (line 412) | ::std::vector<std::string> GetArgvs() {
function FilePath (line 425) | FilePath GetCurrentExecutableName() {
function TypeId (line 644) | TypeId GetTestTypeId() {
function AssertionResult (line 655) | static AssertionResult HasOneFailure(const char* /* results_expr */,
function TestPartResultReporterInterface (line 725) | TestPartResultReporterInterface*
function TestPartResultReporterInterface (line 739) | TestPartResultReporterInterface*
function TimeInMillis (line 832) | TimeInMillis GetTimeInMillis() {
function LPCWSTR (line 880) | LPCWSTR String::AnsiToUtf16(const char* ansi) {
function StreamWideCharsToMessage (line 927) | static void StreamWideCharsToMessage(const wchar_t* wstr, size_t len...
function SplitString (line 943) | void SplitString(const ::std::string& str, char delimiter,
type edit_distance (line 1037) | namespace edit_distance {
function CalculateOptimalEdits (line 1038) | std::vector<EditType> CalculateOptimalEdits(const std::vector<size...
class InternalStrings (line 1098) | class InternalStrings {
method GetId (line 1100) | size_t GetId(const std::string& str) {
function CalculateOptimalEdits (line 1114) | std::vector<EditType> CalculateOptimalEdits(
class Hunk (line 1136) | class Hunk {
method Hunk (line 1138) | Hunk(size_t left_start, size_t right_start)
method PushLine (line 1145) | void PushLine(char edit, const char* line) {
method PrintTo (line 1163) | void PrintTo(std::ostream* os) {
method has_edits (line 1173) | bool has_edits() const { return adds_ || removes_; }
method FlushEdits (line 1176) | void FlushEdits() {
method PrintHeader (line 1185) | void PrintHeader(std::ostream* ss) const {
function CreateUnifiedDiff (line 1213) | std::string CreateUnifiedDiff(const std::vector<std::string>& left,
function SplitEscapedString (line 1283) | std::vector<std::string> SplitEscapedString(const std::string& str) {
function AssertionResult (line 1323) | AssertionResult EqFailure(const char* lhs_expression,
function GetBoolAssertionFailureMessage (line 1358) | std::string GetBoolAssertionFailureMessage(
function AssertionResult (line 1374) | AssertionResult DoubleNearPredFormat(const char* expr1,
function AssertionResult (line 1394) | AssertionResult FloatingPointLE(const char* expr1,
function AssertionResult (line 1447) | AssertionResult CmpHelperEQ(const char* lhs_expression,
function AssertionResult (line 1431) | AssertionResult FloatLE(const char* expr1, const char* expr2,
function AssertionResult (line 1438) | AssertionResult DoubleLE(const char* expr1, const char* expr2,
type internal (line 1443) | namespace internal {
function FILE (line 188) | static FILE* OpenFileForWriting(const std::string& output_file) {
function UInt32 (line 336) | UInt32 Random::Generate(UInt32 range) {
function GTestIsInitialized (line 356) | static bool GTestIsInitialized() { return GetArgvs().size() > 0; }
function SumOverTestSuiteList (line 361) | static int SumOverTestSuiteList(const std::vector<TestSuite*>& case_...
function TestSuitePassed (line 371) | static bool TestSuitePassed(const TestSuite* test_suite) {
function TestSuiteFailed (line 376) | static bool TestSuiteFailed(const TestSuite* test_suite) {
function ShouldRunTestSuite (line 382) | static bool ShouldRunTestSuite(const TestSuite* test_suite) {
function GetArgvs (line 412) | ::std::vector<std::string> GetArgvs() {
function FilePath (line 425) | FilePath GetCurrentExecutableName() {
function TypeId (line 644) | TypeId GetTestTypeId() {
function AssertionResult (line 655) | static AssertionResult HasOneFailure(const char* /* results_expr */,
function TestPartResultReporterInterface (line 725) | TestPartResultReporterInterface*
function TestPartResultReporterInterface (line 739) | TestPartResultReporterInterface*
function TimeInMillis (line 832) | TimeInMillis GetTimeInMillis() {
function LPCWSTR (line 880) | LPCWSTR String::AnsiToUtf16(const char* ansi) {
function StreamWideCharsToMessage (line 927) | static void StreamWideCharsToMessage(const wchar_t* wstr, size_t len...
function SplitString (line 943) | void SplitString(const ::std::string& str, char delimiter,
type edit_distance (line 1037) | namespace edit_distance {
function CalculateOptimalEdits (line 1038) | std::vector<EditType> CalculateOptimalEdits(const std::vector<size...
class InternalStrings (line 1098) | class InternalStrings {
method GetId (line 1100) | size_t GetId(const std::string& str) {
function CalculateOptimalEdits (line 1114) | std::vector<EditType> CalculateOptimalEdits(
class Hunk (line 1136) | class Hunk {
method Hunk (line 1138) | Hunk(size_t left_start, size_t right_start)
method PushLine (line 1145) | void PushLine(char edit, const char* line) {
method PrintTo (line 1163) | void PrintTo(std::ostream* os) {
method has_edits (line 1173) | bool has_edits() const { return adds_ || removes_; }
method FlushEdits (line 1176) | void FlushEdits() {
method PrintHeader (line 1185) | void PrintHeader(std::ostream* ss) const {
function CreateUnifiedDiff (line 1213) | std::string CreateUnifiedDiff(const std::vector<std::string>& left,
function SplitEscapedString (line 1283) | std::vector<std::string> SplitEscapedString(const std::string& str) {
function AssertionResult (line 1323) | AssertionResult EqFailure(const char* lhs_expression,
function GetBoolAssertionFailureMessage (line 1358) | std::string GetBoolAssertionFailureMessage(
function AssertionResult (line 1374) | AssertionResult DoubleNearPredFormat(const char* expr1,
function AssertionResult (line 1394) | AssertionResult FloatingPointLE(const char* expr1,
function AssertionResult (line 1447) | AssertionResult CmpHelperEQ(const char* lhs_expression,
function AssertionResult (line 1543) | AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
function IsSubstringPred (line 1567) | bool IsSubstringPred(const char* needle, const char* haystack) {
function IsSubstringPred (line 1573) | bool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) {
function IsSubstringPred (line 1581) | bool IsSubstringPred(const StringType& needle,
function AssertionResult (line 1591) | AssertionResult IsSubstringImpl(
function AssertionResult (line 1614) | AssertionResult IsSubstring(
function AssertionResult (line 1620) | AssertionResult IsSubstring(
function AssertionResult (line 1626) | AssertionResult IsNotSubstring(
function AssertionResult (line 1632) | AssertionResult IsNotSubstring(
function AssertionResult (line 1638) | AssertionResult IsSubstring(
function AssertionResult (line 1644) | AssertionResult IsNotSubstring(
function AssertionResult (line 1651) | AssertionResult IsSubstring(
function AssertionResult (line 1657) | AssertionResult IsNotSubstring(
type internal (line 1664) | namespace internal {
function AssertionResult (line 1671) | AssertionResult HRESULTFailureHelper(const char* expr,
function AssertionResult (line 1712) | AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
function AssertionResult (line 1719) | AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
function UInt32 (line 1755) | inline UInt32 ChopLowBits(UInt32* bits, int n) {
function CodePointToUtf8 (line 1767) | std::string CodePointToUtf8(UInt32 code_point) {
function IsUtf16SurrogatePair (line 1802) | inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
function UInt32 (line 1808) | inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
function WideStringToUtf8 (line 1834) | std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
function AssertionResult (line 1880) | AssertionResult CmpHelperSTREQ(const char* lhs_expression,
function AssertionResult (line 1896) | AssertionResult CmpHelperSTRNE(const char* s1_expression,
function StringStreamToString (line 1996) | std::string StringStreamToString(::std::stringstream* ss) {
function AppendUserMessage (line 2015) | std::string AppendUserMessage(const std::string& gtest_msg,
function ReportFailureInUnknownLocation (line 2284) | void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
function FormatCxxExceptionMessage (line 2386) | static std::string FormatCxxExceptionMessage(const char* description,
function Result (line 2417) | Result HandleSehExceptionsInMethodIfSupported(
function Result (line 2444) | Result HandleExceptionsInMethodIfSupported(
function TestInfo (line 2584) | TestInfo* MakeAndRegisterTestInfo(
function ReportInvalidTestSuiteType (line 2596) | void ReportInvalidTestSuiteType(const char* test_suite_name,
function PrintTestPartResultToString (line 2903) | static std::string PrintTestPartResultToString(
function PrintTestPartResult (line 2913) | static void PrintTestPartResult(const TestPartResult& test_part_result) {
function WORD (line 2936) | static WORD GetColorAttribute(GTestColor color) {
function GetBitOffset (line 2945) | static int GetBitOffset(WORD color_mask) {
function WORD (line 2956) | static WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
function ShouldUseColor (line 2993) | bool ShouldUseColor(bool stdout_is_tty) {
function ColoredPrintf (line 3033) | void ColoredPrintf(GTestColor color, const char* fmt, ...) {
function PrintFullTestCommentIfPresent (line 3086) | static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
class PrettyUnitTestResultPrinter (line 3105) | class PrettyUnitTestResultPrinter : public TestEventListener {
method PrettyUnitTestResultPrinter (line 3107) | PrettyUnitTestResultPrinter() {}
method PrintTestName (line 3108) | static void PrintTestName(const char* test_suite, const char* test) {
method OnTestProgramStart (line 3113) | void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsSetUpEnd (line 3116) | void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsTearDownEnd (line 3134) | void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) overri...
method OnTestProgramEnd (line 3136) | void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
class TestEventRepeater (line 3388) | class TestEventRepeater : public TestEventListener {
method TestEventRepeater (line 3390) | TestEventRepeater() : forwarding_enabled_(true) {}
method forwarding_enabled (line 3397) | bool forwarding_enabled() const { return forwarding_enabled_; }
method set_forwarding_enabled (line 3398) | void set_forwarding_enabled(bool enable) { forwarding_enabled_ = ena...
function TestEventListener (line 3440) | TestEventListener* TestEventRepeater::Release(TestEventListener *liste...
class XmlUnitTestResultPrinter (line 3516) | class XmlUnitTestResultPrinter : public EmptyTestEventListener {
method IsNormalizableWhitespace (line 3530) | static bool IsNormalizableWhitespace(char c) {
method IsValidXmlCharacter (line 3535) | static bool IsValidXmlCharacter(char c) {
method EscapeXmlAttribute (line 3549) | static std::string EscapeXmlAttribute(const std::string& str) {
method EscapeXmlText (line 3554) | static std::string EscapeXmlText(const char* str) {
function FormatTimeInMillisAsSeconds (line 3710) | std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
function PortableLocaltime (line 3716) | static bool PortableLocaltime(time_t seconds, struct tm* out) {
function FormatEpochTimeInMillisAsIso8601 (line 3733) | std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
class JsonUnitTestResultPrinter (line 3982) | class JsonUnitTestResultPrinter : public EmptyTestEventListener {
function FormatTimeInMillisAsDuration (line 4096) | static std::string FormatTimeInMillisAsDuration(TimeInMillis ms) {
function FormatEpochTimeInMillisAsRFC3339 (line 4104) | static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) {
function Indent (line 4117) | static inline std::string Indent(size_t width) {
function GTEST_LOCK_EXCLUDED_ (line 4432) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4481) | GTEST_LOCK_EXCLUDED_(mutex_) {
class ScopedPrematureExitFile (line 4495) | class ScopedPrematureExitFile {
method ScopedPrematureExitFile (line 4497) | explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
class TestSuiteNameIs (line 5157) | class TestSuiteNameIs {
method TestSuiteNameIs (line 5160) | explicit TestSuiteNameIs(const std::string& name) : name_(name) {}
function TestSuite (line 5184) | TestSuite* UnitTestImpl::GetTestSuite(
function SetUpEnvironment (line 5220) | static void SetUpEnvironment(Environment* env) { env->SetUp(); }
function TearDownEnvironment (line 5221) | static void TearDownEnvironment(Environment* env) { env->TearDown(); }
function WriteToShardStatusFileIfNeeded (line 5399) | void WriteToShardStatusFileIfNeeded() {
function ShouldShard (line 5421) | bool ShouldShard(const char* total_shards_env,
function Int32 (line 5466) | Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
function ShouldRunTestOnShard (line 5484) | bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_...
function PrintOnOneLine (line 5550) | static void PrintOnOneLine(const char* str, int max_length) {
function OsStackTraceGetterInterface (line 5637) | OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
function TestResult (line 5650) | TestResult* UnitTestImpl::current_test_result() {
function GetCurrentOsStackTraceExceptTop (line 5696) | std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
class ClassUniqueToAlwaysTrue (line 5706) | class ClassUniqueToAlwaysTrue {}
function IsTrue (line 5709) | bool IsTrue(bool condition) { return condition; }
function AlwaysTrue (line 5711) | bool AlwaysTrue() {
function SkipPrefix (line 5724) | bool SkipPrefix(const char* prefix, const char** pstr) {
function ParseBoolFlag (line 5775) | static bool ParseBoolFlag(const char* str, const char* flag, bool* val...
function ParseInt32Flag (line 5792) | bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
function ParseStringFlag (line 5810) | static bool ParseStringFlag(const char* str, const char* flag, String*...
function HasGoogleTestFlagPrefix (line 5828) | static bool HasGoogleTestFlagPrefix(const char* str) {
function PrintColorEncoded (line 5846) | static void PrintColorEncoded(const char* str) {
function ParseGoogleTestFlag (line 5945) | static bool ParseGoogleTestFlag(const char* const arg) {
function LoadFlagsFromFile (line 5976) | static void LoadFlagsFromFile(const std::string& path) {
function ParseGoogleTestFlagsOnlyImpl (line 5999) | void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
function ParseGoogleTestFlagsOnly (line 6052) | void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
function ParseGoogleTestFlagsOnly (line 6066) | void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
function InitGoogleTestImpl (line 6075) | void InitGoogleTestImpl(int* argc, CharType** argv) {
function TestPartResult (line 2041) | const TestPartResult& TestResult::GetTestPartResult(int i) const {
function TestProperty (line 2050) | const TestProperty& TestResult::GetTestProperty(int i) const {
function ArrayAsVector (line 2115) | std::vector<std::string> ArrayAsVector(const char* const (&array)[kSize]) {
function GetReservedAttributesForElement (line 2119) | static std::vector<std::string> GetReservedAttributesForElement(
function GetReservedOutputAttributesForElement (line 2135) | static std::vector<std::string> GetReservedOutputAttributesForElement(
function FormatWordList (line 2150) | static std::string FormatWordList(const std::vector<std::string>& words) {
function ValidateTestPropertyName (line 2164) | static bool ValidateTestPropertyName(
function TestPartSkipped (line 2194) | static bool TestPartSkipped(const TestPartResult& result) {
function TestPartFatallyFailed (line 2213) | static bool TestPartFatallyFailed(const TestPartResult& result) {
function TestPartNonfatallyFailed (line 2223) | static bool TestPartNonfatallyFailed(const TestPartResult& result) {
type internal (line 2282) | namespace internal {
function AssertionResult (line 1671) | AssertionResult HRESULTFailureHelper(const char* expr,
function AssertionResult (line 1712) | AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
function AssertionResult (line 1719) | AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
function UInt32 (line 1755) | inline UInt32 ChopLowBits(UInt32* bits, int n) {
function CodePointToUtf8 (line 1767) | std::string CodePointToUtf8(UInt32 code_point) {
function IsUtf16SurrogatePair (line 1802) | inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
function UInt32 (line 1808) | inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
function WideStringToUtf8 (line 1834) | std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
function AssertionResult (line 1880) | AssertionResult CmpHelperSTREQ(const char* lhs_expression,
function AssertionResult (line 1896) | AssertionResult CmpHelperSTRNE(const char* s1_expression,
function StringStreamToString (line 1996) | std::string StringStreamToString(::std::stringstream* ss) {
function AppendUserMessage (line 2015) | std::string AppendUserMessage(const std::string& gtest_msg,
function ReportFailureInUnknownLocation (line 2284) | void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
function FormatCxxExceptionMessage (line 2386) | static std::string FormatCxxExceptionMessage(const char* description,
function Result (line 2417) | Result HandleSehExceptionsInMethodIfSupported(
function Result (line 2444) | Result HandleExceptionsInMethodIfSupported(
function TestInfo (line 2584) | TestInfo* MakeAndRegisterTestInfo(
function ReportInvalidTestSuiteType (line 2596) | void ReportInvalidTestSuiteType(const char* test_suite_name,
function PrintTestPartResultToString (line 2903) | static std::string PrintTestPartResultToString(
function PrintTestPartResult (line 2913) | static void PrintTestPartResult(const TestPartResult& test_part_result) {
function WORD (line 2936) | static WORD GetColorAttribute(GTestColor color) {
function GetBitOffset (line 2945) | static int GetBitOffset(WORD color_mask) {
function WORD (line 2956) | static WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
function ShouldUseColor (line 2993) | bool ShouldUseColor(bool stdout_is_tty) {
function ColoredPrintf (line 3033) | void ColoredPrintf(GTestColor color, const char* fmt, ...) {
function PrintFullTestCommentIfPresent (line 3086) | static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
class PrettyUnitTestResultPrinter (line 3105) | class PrettyUnitTestResultPrinter : public TestEventListener {
method PrettyUnitTestResultPrinter (line 3107) | PrettyUnitTestResultPrinter() {}
method PrintTestName (line 3108) | static void PrintTestName(const char* test_suite, const char* test) {
method OnTestProgramStart (line 3113) | void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsSetUpEnd (line 3116) | void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsTearDownEnd (line 3134) | void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) overri...
method OnTestProgramEnd (line 3136) | void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
class TestEventRepeater (line 3388) | class TestEventRepeater : public TestEventListener {
method TestEventRepeater (line 3390) | TestEventRepeater() : forwarding_enabled_(true) {}
method forwarding_enabled (line 3397) | bool forwarding_enabled() const { return forwarding_enabled_; }
method set_forwarding_enabled (line 3398) | void set_forwarding_enabled(bool enable) { forwarding_enabled_ = ena...
function TestEventListener (line 3440) | TestEventListener* TestEventRepeater::Release(TestEventListener *liste...
class XmlUnitTestResultPrinter (line 3516) | class XmlUnitTestResultPrinter : public EmptyTestEventListener {
method IsNormalizableWhitespace (line 3530) | static bool IsNormalizableWhitespace(char c) {
method IsValidXmlCharacter (line 3535) | static bool IsValidXmlCharacter(char c) {
method EscapeXmlAttribute (line 3549) | static std::string EscapeXmlAttribute(const std::string& str) {
method EscapeXmlText (line 3554) | static std::string EscapeXmlText(const char* str) {
function FormatTimeInMillisAsSeconds (line 3710) | std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
function PortableLocaltime (line 3716) | static bool PortableLocaltime(time_t seconds, struct tm* out) {
function FormatEpochTimeInMillisAsIso8601 (line 3733) | std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
class JsonUnitTestResultPrinter (line 3982) | class JsonUnitTestResultPrinter : public EmptyTestEventListener {
function FormatTimeInMillisAsDuration (line 4096) | static std::string FormatTimeInMillisAsDuration(TimeInMillis ms) {
function FormatEpochTimeInMillisAsRFC3339 (line 4104) | static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) {
function Indent (line 4117) | static inline std::string Indent(size_t width) {
function GTEST_LOCK_EXCLUDED_ (line 4432) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4481) | GTEST_LOCK_EXCLUDED_(mutex_) {
class ScopedPrematureExitFile (line 4495) | class ScopedPrematureExitFile {
method ScopedPrematureExitFile (line 4497) | explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
class TestSuiteNameIs (line 5157) | class TestSuiteNameIs {
method TestSuiteNameIs (line 5160) | explicit TestSuiteNameIs(const std::string& name) : name_(name) {}
function TestSuite (line 5184) | TestSuite* UnitTestImpl::GetTestSuite(
function SetUpEnvironment (line 5220) | static void SetUpEnvironment(Environment* env) { env->SetUp(); }
function TearDownEnvironment (line 5221) | static void TearDownEnvironment(Environment* env) { env->TearDown(); }
function WriteToShardStatusFileIfNeeded (line 5399) | void WriteToShardStatusFileIfNeeded() {
function ShouldShard (line 5421) | bool ShouldShard(const char* total_shards_env,
function Int32 (line 5466) | Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
function ShouldRunTestOnShard (line 5484) | bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_...
function PrintOnOneLine (line 5550) | static void PrintOnOneLine(const char* str, int max_length) {
function OsStackTraceGetterInterface (line 5637) | OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
function TestResult (line 5650) | TestResult* UnitTestImpl::current_test_result() {
function GetCurrentOsStackTraceExceptTop (line 5696) | std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
class ClassUniqueToAlwaysTrue (line 5706) | class ClassUniqueToAlwaysTrue {}
function IsTrue (line 5709) | bool IsTrue(bool condition) { return condition; }
function AlwaysTrue (line 5711) | bool AlwaysTrue() {
function SkipPrefix (line 5724) | bool SkipPrefix(const char* prefix, const char** pstr) {
function ParseBoolFlag (line 5775) | static bool ParseBoolFlag(const char* str, const char* flag, bool* val...
function ParseInt32Flag (line 5792) | bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
function ParseStringFlag (line 5810) | static bool ParseStringFlag(const char* str, const char* flag, String*...
function HasGoogleTestFlagPrefix (line 5828) | static bool HasGoogleTestFlagPrefix(const char* str) {
function PrintColorEncoded (line 5846) | static void PrintColorEncoded(const char* str) {
function ParseGoogleTestFlag (line 5945) | static bool ParseGoogleTestFlag(const char* const arg) {
function LoadFlagsFromFile (line 5976) | static void LoadFlagsFromFile(const std::string& path) {
function ParseGoogleTestFlagsOnlyImpl (line 5999) | void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
function ParseGoogleTestFlagsOnly (line 6052) | void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
function ParseGoogleTestFlagsOnly (line 6066) | void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
function InitGoogleTestImpl (line 6075) | void InitGoogleTestImpl(int* argc, CharType** argv) {
type internal (line 2381) | namespace internal {
function AssertionResult (line 1671) | AssertionResult HRESULTFailureHelper(const char* expr,
function AssertionResult (line 1712) | AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
function AssertionResult (line 1719) | AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
function UInt32 (line 1755) | inline UInt32 ChopLowBits(UInt32* bits, int n) {
function CodePointToUtf8 (line 1767) | std::string CodePointToUtf8(UInt32 code_point) {
function IsUtf16SurrogatePair (line 1802) | inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
function UInt32 (line 1808) | inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
function WideStringToUtf8 (line 1834) | std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
function AssertionResult (line 1880) | AssertionResult CmpHelperSTREQ(const char* lhs_expression,
function AssertionResult (line 1896) | AssertionResult CmpHelperSTRNE(const char* s1_expression,
function StringStreamToString (line 1996) | std::string StringStreamToString(::std::stringstream* ss) {
function AppendUserMessage (line 2015) | std::string AppendUserMessage(const std::string& gtest_msg,
function ReportFailureInUnknownLocation (line 2284) | void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
function FormatCxxExceptionMessage (line 2386) | static std::string FormatCxxExceptionMessage(const char* description,
function Result (line 2417) | Result HandleSehExceptionsInMethodIfSupported(
function Result (line 2444) | Result HandleExceptionsInMethodIfSupported(
function TestInfo (line 2584) | TestInfo* MakeAndRegisterTestInfo(
function ReportInvalidTestSuiteType (line 2596) | void ReportInvalidTestSuiteType(const char* test_suite_name,
function PrintTestPartResultToString (line 2903) | static std::string PrintTestPartResultToString(
function PrintTestPartResult (line 2913) | static void PrintTestPartResult(const TestPartResult& test_part_result) {
function WORD (line 2936) | static WORD GetColorAttribute(GTestColor color) {
function GetBitOffset (line 2945) | static int GetBitOffset(WORD color_mask) {
function WORD (line 2956) | static WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
function ShouldUseColor (line 2993) | bool ShouldUseColor(bool stdout_is_tty) {
function ColoredPrintf (line 3033) | void ColoredPrintf(GTestColor color, const char* fmt, ...) {
function PrintFullTestCommentIfPresent (line 3086) | static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
class PrettyUnitTestResultPrinter (line 3105) | class PrettyUnitTestResultPrinter : public TestEventListener {
method PrettyUnitTestResultPrinter (line 3107) | PrettyUnitTestResultPrinter() {}
method PrintTestName (line 3108) | static void PrintTestName(const char* test_suite, const char* test) {
method OnTestProgramStart (line 3113) | void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsSetUpEnd (line 3116) | void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsTearDownEnd (line 3134) | void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) overri...
method OnTestProgramEnd (line 3136) | void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
class TestEventRepeater (line 3388) | class TestEventRepeater : public TestEventListener {
method TestEventRepeater (line 3390) | TestEventRepeater() : forwarding_enabled_(true) {}
method forwarding_enabled (line 3397) | bool forwarding_enabled() const { return forwarding_enabled_; }
method set_forwarding_enabled (line 3398) | void set_forwarding_enabled(bool enable) { forwarding_enabled_ = ena...
function TestEventListener (line 3440) | TestEventListener* TestEventRepeater::Release(TestEventListener *liste...
class XmlUnitTestResultPrinter (line 3516) | class XmlUnitTestResultPrinter : public EmptyTestEventListener {
method IsNormalizableWhitespace (line 3530) | static bool IsNormalizableWhitespace(char c) {
method IsValidXmlCharacter (line 3535) | static bool IsValidXmlCharacter(char c) {
method EscapeXmlAttribute (line 3549) | static std::string EscapeXmlAttribute(const std::string& str) {
method EscapeXmlText (line 3554) | static std::string EscapeXmlText(const char* str) {
function FormatTimeInMillisAsSeconds (line 3710) | std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
function PortableLocaltime (line 3716) | static bool PortableLocaltime(time_t seconds, struct tm* out) {
function FormatEpochTimeInMillisAsIso8601 (line 3733) | std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
class JsonUnitTestResultPrinter (line 3982) | class JsonUnitTestResultPrinter : public EmptyTestEventListener {
function FormatTimeInMillisAsDuration (line 4096) | static std::string FormatTimeInMillisAsDuration(TimeInMillis ms) {
function FormatEpochTimeInMillisAsRFC3339 (line 4104) | static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) {
function Indent (line 4117) | static inline std::string Indent(size_t width) {
function GTEST_LOCK_EXCLUDED_ (line 4432) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4481) | GTEST_LOCK_EXCLUDED_(mutex_) {
class ScopedPrematureExitFile (line 4495) | class ScopedPrematureExitFile {
method ScopedPrematureExitFile (line 4497) | explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
class TestSuiteNameIs (line 5157) | class TestSuiteNameIs {
method TestSuiteNameIs (line 5160) | explicit TestSuiteNameIs(const std::string& name) : name_(name) {}
function TestSuite (line 5184) | TestSuite* UnitTestImpl::GetTestSuite(
function SetUpEnvironment (line 5220) | static void SetUpEnvironment(Environment* env) { env->SetUp(); }
function TearDownEnvironment (line 5221) | static void TearDownEnvironment(Environment* env) { env->TearDown(); }
function WriteToShardStatusFileIfNeeded (line 5399) | void WriteToShardStatusFileIfNeeded() {
function ShouldShard (line 5421) | bool ShouldShard(const char* total_shards_env,
function Int32 (line 5466) | Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
function ShouldRunTestOnShard (line 5484) | bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_...
function PrintOnOneLine (line 5550) | static void PrintOnOneLine(const char* str, int max_length) {
function OsStackTraceGetterInterface (line 5637) | OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
function TestResult (line 5650) | TestResult* UnitTestImpl::current_test_result() {
function GetCurrentOsStackTraceExceptTop (line 5696) | std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
class ClassUniqueToAlwaysTrue (line 5706) | class ClassUniqueToAlwaysTrue {}
function IsTrue (line 5709) | bool IsTrue(bool condition) { return condition; }
function AlwaysTrue (line 5711) | bool AlwaysTrue() {
function SkipPrefix (line 5724) | bool SkipPrefix(const char* prefix, const char** pstr) {
function ParseBoolFlag (line 5775) | static bool ParseBoolFlag(const char* str, const char* flag, bool* val...
function ParseInt32Flag (line 5792) | bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
function ParseStringFlag (line 5810) | static bool ParseStringFlag(const char* str, const char* flag, String*...
function HasGoogleTestFlagPrefix (line 5828) | static bool HasGoogleTestFlagPrefix(const char* str) {
function PrintColorEncoded (line 5846) | static void PrintColorEncoded(const char* str) {
function ParseGoogleTestFlag (line 5945) | static bool ParseGoogleTestFlag(const char* const arg) {
function LoadFlagsFromFile (line 5976) | static void LoadFlagsFromFile(const std::string& path) {
function ParseGoogleTestFlagsOnlyImpl (line 5999) | void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
function ParseGoogleTestFlagsOnly (line 6052) | void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
function ParseGoogleTestFlagsOnly (line 6066) | void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
function InitGoogleTestImpl (line 6075) | void InitGoogleTestImpl(int* argc, CharType** argv) {
type internal (line 2564) | namespace internal {
function AssertionResult (line 1671) | AssertionResult HRESULTFailureHelper(const char* expr,
function AssertionResult (line 1712) | AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
function AssertionResult (line 1719) | AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
function UInt32 (line 1755) | inline UInt32 ChopLowBits(UInt32* bits, int n) {
function CodePointToUtf8 (line 1767) | std::string CodePointToUtf8(UInt32 code_point) {
function IsUtf16SurrogatePair (line 1802) | inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
function UInt32 (line 1808) | inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
function WideStringToUtf8 (line 1834) | std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
function AssertionResult (line 1880) | AssertionResult CmpHelperSTREQ(const char* lhs_expression,
function AssertionResult (line 1896) | AssertionResult CmpHelperSTRNE(const char* s1_expression,
function StringStreamToString (line 1996) | std::string StringStreamToString(::std::stringstream* ss) {
function AppendUserMessage (line 2015) | std::string AppendUserMessage(const std::string& gtest_msg,
function ReportFailureInUnknownLocation (line 2284) | void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
function FormatCxxExceptionMessage (line 2386) | static std::string FormatCxxExceptionMessage(const char* description,
function Result (line 2417) | Result HandleSehExceptionsInMethodIfSupported(
function Result (line 2444) | Result HandleExceptionsInMethodIfSupported(
function TestInfo (line 2584) | TestInfo* MakeAndRegisterTestInfo(
function ReportInvalidTestSuiteType (line 2596) | void ReportInvalidTestSuiteType(const char* test_suite_name,
function PrintTestPartResultToString (line 2903) | static std::string PrintTestPartResultToString(
function PrintTestPartResult (line 2913) | static void PrintTestPartResult(const TestPartResult& test_part_result) {
function WORD (line 2936) | static WORD GetColorAttribute(GTestColor color) {
function GetBitOffset (line 2945) | static int GetBitOffset(WORD color_mask) {
function WORD (line 2956) | static WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
function ShouldUseColor (line 2993) | bool ShouldUseColor(bool stdout_is_tty) {
function ColoredPrintf (line 3033) | void ColoredPrintf(GTestColor color, const char* fmt, ...) {
function PrintFullTestCommentIfPresent (line 3086) | static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
class PrettyUnitTestResultPrinter (line 3105) | class PrettyUnitTestResultPrinter : public TestEventListener {
method PrettyUnitTestResultPrinter (line 3107) | PrettyUnitTestResultPrinter() {}
method PrintTestName (line 3108) | static void PrintTestName(const char* test_suite, const char* test) {
method OnTestProgramStart (line 3113) | void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsSetUpEnd (line 3116) | void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsTearDownEnd (line 3134) | void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) overri...
method OnTestProgramEnd (line 3136) | void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
class TestEventRepeater (line 3388) | class TestEventRepeater : public TestEventListener {
method TestEventRepeater (line 3390) | TestEventRepeater() : forwarding_enabled_(true) {}
method forwarding_enabled (line 3397) | bool forwarding_enabled() const { return forwarding_enabled_; }
method set_forwarding_enabled (line 3398) | void set_forwarding_enabled(bool enable) { forwarding_enabled_ = ena...
function TestEventListener (line 3440) | TestEventListener* TestEventRepeater::Release(TestEventListener *liste...
class XmlUnitTestResultPrinter (line 3516) | class XmlUnitTestResultPrinter : public EmptyTestEventListener {
method IsNormalizableWhitespace (line 3530) | static bool IsNormalizableWhitespace(char c) {
method IsValidXmlCharacter (line 3535) | static bool IsValidXmlCharacter(char c) {
method EscapeXmlAttribute (line 3549) | static std::string EscapeXmlAttribute(const std::string& str) {
method EscapeXmlText (line 3554) | static std::string EscapeXmlText(const char* str) {
function FormatTimeInMillisAsSeconds (line 3710) | std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
function PortableLocaltime (line 3716) | static bool PortableLocaltime(time_t seconds, struct tm* out) {
function FormatEpochTimeInMillisAsIso8601 (line 3733) | std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
class JsonUnitTestResultPrinter (line 3982) | class JsonUnitTestResultPrinter : public EmptyTestEventListener {
function FormatTimeInMillisAsDuration (line 4096) | static std::string FormatTimeInMillisAsDuration(TimeInMillis ms) {
function FormatEpochTimeInMillisAsRFC3339 (line 4104) | static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) {
function Indent (line 4117) | static inline std::string Indent(size_t width) {
function GTEST_LOCK_EXCLUDED_ (line 4432) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4481) | GTEST_LOCK_EXCLUDED_(mutex_) {
class ScopedPrematureExitFile (line 4495) | class ScopedPrematureExitFile {
method ScopedPrematureExitFile (line 4497) | explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
class TestSuiteNameIs (line 5157) | class TestSuiteNameIs {
method TestSuiteNameIs (line 5160) | explicit TestSuiteNameIs(const std::string& name) : name_(name) {}
function TestSuite (line 5184) | TestSuite* UnitTestImpl::GetTestSuite(
function SetUpEnvironment (line 5220) | static void SetUpEnvironment(Environment* env) { env->SetUp(); }
function TearDownEnvironment (line 5221) | static void TearDownEnvironment(Environment* env) { env->TearDown(); }
function WriteToShardStatusFileIfNeeded (line 5399) | void WriteToShardStatusFileIfNeeded() {
function ShouldShard (line 5421) | bool ShouldShard(const char* total_shards_env,
function Int32 (line 5466) | Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
function ShouldRunTestOnShard (line 5484) | bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_...
function PrintOnOneLine (line 5550) | static void PrintOnOneLine(const char* str, int max_length) {
function OsStackTraceGetterInterface (line 5637) | OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
function TestResult (line 5650) | TestResult* UnitTestImpl::current_test_result() {
function GetCurrentOsStackTraceExceptTop (line 5696) | std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
class ClassUniqueToAlwaysTrue (line 5706) | class ClassUniqueToAlwaysTrue {}
function IsTrue (line 5709) | bool IsTrue(bool condition) { return condition; }
function AlwaysTrue (line 5711) | bool AlwaysTrue() {
function SkipPrefix (line 5724) | bool SkipPrefix(const char* prefix, const char** pstr) {
function ParseBoolFlag (line 5775) | static bool ParseBoolFlag(const char* str, const char* flag, bool* val...
function ParseInt32Flag (line 5792) | bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
function ParseStringFlag (line 5810) | static bool ParseStringFlag(const char* str, const char* flag, String*...
function HasGoogleTestFlagPrefix (line 5828) | static bool HasGoogleTestFlagPrefix(const char* str) {
function PrintColorEncoded (line 5846) | static void PrintColorEncoded(const char* str) {
function ParseGoogleTestFlag (line 5945) | static bool ParseGoogleTestFlag(const char* const arg) {
function LoadFlagsFromFile (line 5976) | static void LoadFlagsFromFile(const std::string& path) {
function ParseGoogleTestFlagsOnlyImpl (line 5999) | void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
function ParseGoogleTestFlagsOnly (line 6052) | void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
function ParseGoogleTestFlagsOnly (line 6066) | void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
function InitGoogleTestImpl (line 6075) | void InitGoogleTestImpl(int* argc, CharType** argv) {
class TestNameIs (line 2625) | class TestNameIs {
method TestNameIs (line 2630) | explicit TestNameIs(const char* name)
type internal (line 2644) | namespace internal {
function AssertionResult (line 1671) | AssertionResult HRESULTFailureHelper(const char* expr,
function AssertionResult (line 1712) | AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
function AssertionResult (line 1719) | AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
function UInt32 (line 1755) | inline UInt32 ChopLowBits(UInt32* bits, int n) {
function CodePointToUtf8 (line 1767) | std::string CodePointToUtf8(UInt32 code_point) {
function IsUtf16SurrogatePair (line 1802) | inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
function UInt32 (line 1808) | inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
function WideStringToUtf8 (line 1834) | std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
function AssertionResult (line 1880) | AssertionResult CmpHelperSTREQ(const char* lhs_expression,
function AssertionResult (line 1896) | AssertionResult CmpHelperSTRNE(const char* s1_expression,
function StringStreamToString (line 1996) | std::string StringStreamToString(::std::stringstream* ss) {
function AppendUserMessage (line 2015) | std::string AppendUserMessage(const std::string& gtest_msg,
function ReportFailureInUnknownLocation (line 2284) | void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
function FormatCxxExceptionMessage (line 2386) | static std::string FormatCxxExceptionMessage(const char* description,
function Result (line 2417) | Result HandleSehExceptionsInMethodIfSupported(
function Result (line 2444) | Result HandleExceptionsInMethodIfSupported(
function TestInfo (line 2584) | TestInfo* MakeAndRegisterTestInfo(
function ReportInvalidTestSuiteType (line 2596) | void ReportInvalidTestSuiteType(const char* test_suite_name,
function PrintTestPartResultToString (line 2903) | static std::string PrintTestPartResultToString(
function PrintTestPartResult (line 2913) | static void PrintTestPartResult(const TestPartResult& test_part_result) {
function WORD (line 2936) | static WORD GetColorAttribute(GTestColor color) {
function GetBitOffset (line 2945) | static int GetBitOffset(WORD color_mask) {
function WORD (line 2956) | static WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
function ShouldUseColor (line 2993) | bool ShouldUseColor(bool stdout_is_tty) {
function ColoredPrintf (line 3033) | void ColoredPrintf(GTestColor color, const char* fmt, ...) {
function PrintFullTestCommentIfPresent (line 3086) | static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
class PrettyUnitTestResultPrinter (line 3105) | class PrettyUnitTestResultPrinter : public TestEventListener {
method PrettyUnitTestResultPrinter (line 3107) | PrettyUnitTestResultPrinter() {}
method PrintTestName (line 3108) | static void PrintTestName(const char* test_suite, const char* test) {
method OnTestProgramStart (line 3113) | void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsSetUpEnd (line 3116) | void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsTearDownEnd (line 3134) | void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) overri...
method OnTestProgramEnd (line 3136) | void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
class TestEventRepeater (line 3388) | class TestEventRepeater : public TestEventListener {
method TestEventRepeater (line 3390) | TestEventRepeater() : forwarding_enabled_(true) {}
method forwarding_enabled (line 3397) | bool forwarding_enabled() const { return forwarding_enabled_; }
method set_forwarding_enabled (line 3398) | void set_forwarding_enabled(bool enable) { forwarding_enabled_ = ena...
function TestEventListener (line 3440) | TestEventListener* TestEventRepeater::Release(TestEventListener *liste...
class XmlUnitTestResultPrinter (line 3516) | class XmlUnitTestResultPrinter : public EmptyTestEventListener {
method IsNormalizableWhitespace (line 3530) | static bool IsNormalizableWhitespace(char c) {
method IsValidXmlCharacter (line 3535) | static bool IsValidXmlCharacter(char c) {
method EscapeXmlAttribute (line 3549) | static std::string EscapeXmlAttribute(const std::string& str) {
method EscapeXmlText (line 3554) | static std::string EscapeXmlText(const char* str) {
function FormatTimeInMillisAsSeconds (line 3710) | std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
function PortableLocaltime (line 3716) | static bool PortableLocaltime(time_t seconds, struct tm* out) {
function FormatEpochTimeInMillisAsIso8601 (line 3733) | std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
class JsonUnitTestResultPrinter (line 3982) | class JsonUnitTestResultPrinter : public EmptyTestEventListener {
function FormatTimeInMillisAsDuration (line 4096) | static std::string FormatTimeInMillisAsDuration(TimeInMillis ms) {
function FormatEpochTimeInMillisAsRFC3339 (line 4104) | static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) {
function Indent (line 4117) | static inline std::string Indent(size_t width) {
function GTEST_LOCK_EXCLUDED_ (line 4432) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4481) | GTEST_LOCK_EXCLUDED_(mutex_) {
class ScopedPrematureExitFile (line 4495) | class ScopedPrematureExitFile {
method ScopedPrematureExitFile (line 4497) | explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
class TestSuiteNameIs (line 5157) | class TestSuiteNameIs {
method TestSuiteNameIs (line 5160) | explicit TestSuiteNameIs(const std::string& name) : name_(name) {}
function TestSuite (line 5184) | TestSuite* UnitTestImpl::GetTestSuite(
function SetUpEnvironment (line 5220) | static void SetUpEnvironment(Environment* env) { env->SetUp(); }
function TearDownEnvironment (line 5221) | static void TearDownEnvironment(Environment* env) { env->TearDown(); }
function WriteToShardStatusFileIfNeeded (line 5399) | void WriteToShardStatusFileIfNeeded() {
function ShouldShard (line 5421) | bool ShouldShard(const char* total_shards_env,
function Int32 (line 5466) | Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
function ShouldRunTestOnShard (line 5484) | bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_...
function PrintOnOneLine (line 5550) | static void PrintOnOneLine(const char* str, int max_length) {
function OsStackTraceGetterInterface (line 5637) | OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
function TestResult (line 5650) | TestResult* UnitTestImpl::current_test_result() {
function GetCurrentOsStackTraceExceptTop (line 5696) | std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
class ClassUniqueToAlwaysTrue (line 5706) | class ClassUniqueToAlwaysTrue {}
function IsTrue (line 5709) | bool IsTrue(bool condition) { return condition; }
function AlwaysTrue (line 5711) | bool AlwaysTrue() {
function SkipPrefix (line 5724) | bool SkipPrefix(const char* prefix, const char** pstr) {
function ParseBoolFlag (line 5775) | static bool ParseBoolFlag(const char* str, const char* flag, bool* val...
function ParseInt32Flag (line 5792) | bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
function ParseStringFlag (line 5810) | static bool ParseStringFlag(const char* str, const char* flag, String*...
function HasGoogleTestFlagPrefix (line 5828) | static bool HasGoogleTestFlagPrefix(const char* str) {
function PrintColorEncoded (line 5846) | static void PrintColorEncoded(const char* str) {
function ParseGoogleTestFlag (line 5945) | static bool ParseGoogleTestFlag(const char* const arg) {
function LoadFlagsFromFile (line 5976) | static void LoadFlagsFromFile(const std::string& path) {
function ParseGoogleTestFlagsOnlyImpl (line 5999) | void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
function ParseGoogleTestFlagsOnly (line 6052) | void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
function ParseGoogleTestFlagsOnly (line 6066) | void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
function InitGoogleTestImpl (line 6075) | void InitGoogleTestImpl(int* argc, CharType** argv) {
function TestInfo (line 2778) | const TestInfo* TestSuite::GetTestInfo(int i) const {
function TestInfo (line 2785) | TestInfo* TestSuite::GetMutableTestInfo(int i) {
function FormatCountableNoun (line 2860) | static std::string FormatCountableNoun(int count,
function FormatTestCount (line 2868) | static std::string FormatTestCount(int test_count) {
function FormatTestSuiteCount (line 2873) | static std::string FormatTestSuiteCount(int test_suite_count) {
type internal (line 2900) | namespace internal {
function AssertionResult (line 1671) | AssertionResult HRESULTFailureHelper(const char* expr,
function AssertionResult (line 1712) | AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
function AssertionResult (line 1719) | AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
function UInt32 (line 1755) | inline UInt32 ChopLowBits(UInt32* bits, int n) {
function CodePointToUtf8 (line 1767) | std::string CodePointToUtf8(UInt32 code_point) {
function IsUtf16SurrogatePair (line 1802) | inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
function UInt32 (line 1808) | inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
function WideStringToUtf8 (line 1834) | std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
function AssertionResult (line 1880) | AssertionResult CmpHelperSTREQ(const char* lhs_expression,
function AssertionResult (line 1896) | AssertionResult CmpHelperSTRNE(const char* s1_expression,
function StringStreamToString (line 1996) | std::string StringStreamToString(::std::stringstream* ss) {
function AppendUserMessage (line 2015) | std::string AppendUserMessage(const std::string& gtest_msg,
function ReportFailureInUnknownLocation (line 2284) | void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
function FormatCxxExceptionMessage (line 2386) | static std::string FormatCxxExceptionMessage(const char* description,
function Result (line 2417) | Result HandleSehExceptionsInMethodIfSupported(
function Result (line 2444) | Result HandleExceptionsInMethodIfSupported(
function TestInfo (line 2584) | TestInfo* MakeAndRegisterTestInfo(
function ReportInvalidTestSuiteType (line 2596) | void ReportInvalidTestSuiteType(const char* test_suite_name,
function PrintTestPartResultToString (line 2903) | static std::string PrintTestPartResultToString(
function PrintTestPartResult (line 2913) | static void PrintTestPartResult(const TestPartResult& test_part_result) {
function WORD (line 2936) | static WORD GetColorAttribute(GTestColor color) {
function GetBitOffset (line 2945) | static int GetBitOffset(WORD color_mask) {
function WORD (line 2956) | static WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
function ShouldUseColor (line 2993) | bool ShouldUseColor(bool stdout_is_tty) {
function ColoredPrintf (line 3033) | void ColoredPrintf(GTestColor color, const char* fmt, ...) {
function PrintFullTestCommentIfPresent (line 3086) | static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
class PrettyUnitTestResultPrinter (line 3105) | class PrettyUnitTestResultPrinter : public TestEventListener {
method PrettyUnitTestResultPrinter (line 3107) | PrettyUnitTestResultPrinter() {}
method PrintTestName (line 3108) | static void PrintTestName(const char* test_suite, const char* test) {
method OnTestProgramStart (line 3113) | void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsSetUpEnd (line 3116) | void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsTearDownEnd (line 3134) | void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) overri...
method OnTestProgramEnd (line 3136) | void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
class TestEventRepeater (line 3388) | class TestEventRepeater : public TestEventListener {
method TestEventRepeater (line 3390) | TestEventRepeater() : forwarding_enabled_(true) {}
method forwarding_enabled (line 3397) | bool forwarding_enabled() const { return forwarding_enabled_; }
method set_forwarding_enabled (line 3398) | void set_forwarding_enabled(bool enable) { forwarding_enabled_ = ena...
function TestEventListener (line 3440) | TestEventListener* TestEventRepeater::Release(TestEventListener *liste...
class XmlUnitTestResultPrinter (line 3516) | class XmlUnitTestResultPrinter : public EmptyTestEventListener {
method IsNormalizableWhitespace (line 3530) | static bool IsNormalizableWhitespace(char c) {
method IsValidXmlCharacter (line 3535) | static bool IsValidXmlCharacter(char c) {
method EscapeXmlAttribute (line 3549) | static std::string EscapeXmlAttribute(const std::string& str) {
method EscapeXmlText (line 3554) | static std::string EscapeXmlText(const char* str) {
function FormatTimeInMillisAsSeconds (line 3710) | std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
function PortableLocaltime (line 3716) | static bool PortableLocaltime(time_t seconds, struct tm* out) {
function FormatEpochTimeInMillisAsIso8601 (line 3733) | std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
class JsonUnitTestResultPrinter (line 3982) | class JsonUnitTestResultPrinter : public EmptyTestEventListener {
function FormatTimeInMillisAsDuration (line 4096) | static std::string FormatTimeInMillisAsDuration(TimeInMillis ms) {
function FormatEpochTimeInMillisAsRFC3339 (line 4104) | static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) {
function Indent (line 4117) | static inline std::string Indent(size_t width) {
function GTEST_LOCK_EXCLUDED_ (line 4432) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4481) | GTEST_LOCK_EXCLUDED_(mutex_) {
class ScopedPrematureExitFile (line 4495) | class ScopedPrematureExitFile {
method ScopedPrematureExitFile (line 4497) | explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
class TestSuiteNameIs (line 5157) | class TestSuiteNameIs {
method TestSuiteNameIs (line 5160) | explicit TestSuiteNameIs(const std::string& name) : name_(name) {}
function TestSuite (line 5184) | TestSuite* UnitTestImpl::GetTestSuite(
function SetUpEnvironment (line 5220) | static void SetUpEnvironment(Environment* env) { env->SetUp(); }
function TearDownEnvironment (line 5221) | static void TearDownEnvironment(Environment* env) { env->TearDown(); }
function WriteToShardStatusFileIfNeeded (line 5399) | void WriteToShardStatusFileIfNeeded() {
function ShouldShard (line 5421) | bool ShouldShard(const char* total_shards_env,
function Int32 (line 5466) | Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
function ShouldRunTestOnShard (line 5484) | bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_...
function PrintOnOneLine (line 5550) | static void PrintOnOneLine(const char* str, int max_length) {
function OsStackTraceGetterInterface (line 5637) | OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
function TestResult (line 5650) | TestResult* UnitTestImpl::current_test_result() {
function GetCurrentOsStackTraceExceptTop (line 5696) | std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
class ClassUniqueToAlwaysTrue (line 5706) | class ClassUniqueToAlwaysTrue {}
function IsTrue (line 5709) | bool IsTrue(bool condition) { return condition; }
function AlwaysTrue (line 5711) | bool AlwaysTrue() {
function SkipPrefix (line 5724) | bool SkipPrefix(const char* prefix, const char** pstr) {
function ParseBoolFlag (line 5775) | static bool ParseBoolFlag(const char* str, const char* flag, bool* val...
function ParseInt32Flag (line 5792) | bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
function ParseStringFlag (line 5810) | static bool ParseStringFlag(const char* str, const char* flag, String*...
function HasGoogleTestFlagPrefix (line 5828) | static bool HasGoogleTestFlagPrefix(const char* str) {
function PrintColorEncoded (line 5846) | static void PrintColorEncoded(const char* str) {
function ParseGoogleTestFlag (line 5945) | static bool ParseGoogleTestFlag(const char* const arg) {
function LoadFlagsFromFile (line 5976) | static void LoadFlagsFromFile(const std::string& path) {
function ParseGoogleTestFlagsOnlyImpl (line 5999) | void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
function ParseGoogleTestFlagsOnly (line 6052) | void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
function ParseGoogleTestFlagsOnly (line 6066) | void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
function InitGoogleTestImpl (line 6075) | void InitGoogleTestImpl(int* argc, CharType** argv) {
function TestEventListener (line 4552) | TestEventListener* TestEventListeners::Release(TestEventListener* listen...
function TestEventListener (line 4562) | TestEventListener* TestEventListeners::repeater() { return repeater_; }
function UnitTest (line 4613) | UnitTest* UnitTest::GetInstance() {
function TestSuite (line 4719) | const TestSuite* UnitTest::GetTestSuite(int i) const {
function TestCase (line 4725) | const TestCase* UnitTest::GetTestCase(int i) const {
function TestResult (line 4732) | const TestResult& UnitTest::ad_hoc_test_result() const {
function TestSuite (line 4738) | TestSuite* UnitTest::GetMutableTestSuite(int i) {
function TestEventListeners (line 4744) | TestEventListeners& UnitTest::listeners() {
function Environment (line 4758) | Environment* UnitTest::AddEnvironment(Environment* env) {
function GTEST_LOCK_EXCLUDED_ (line 4776) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4943) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4951) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4960) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4988) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4995) | GTEST_LOCK_EXCLUDED_(mutex_) {
type internal (line 5000) | namespace internal {
function AssertionResult (line 1671) | AssertionResult HRESULTFailureHelper(const char* expr,
function AssertionResult (line 1712) | AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT
function AssertionResult (line 1719) | AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT
function UInt32 (line 1755) | inline UInt32 ChopLowBits(UInt32* bits, int n) {
function CodePointToUtf8 (line 1767) | std::string CodePointToUtf8(UInt32 code_point) {
function IsUtf16SurrogatePair (line 1802) | inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
function UInt32 (line 1808) | inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
function WideStringToUtf8 (line 1834) | std::string WideStringToUtf8(const wchar_t* str, int num_chars) {
function AssertionResult (line 1880) | AssertionResult CmpHelperSTREQ(const char* lhs_expression,
function AssertionResult (line 1896) | AssertionResult CmpHelperSTRNE(const char* s1_expression,
function StringStreamToString (line 1996) | std::string StringStreamToString(::std::stringstream* ss) {
function AppendUserMessage (line 2015) | std::string AppendUserMessage(const std::string& gtest_msg,
function ReportFailureInUnknownLocation (line 2284) | void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
function FormatCxxExceptionMessage (line 2386) | static std::string FormatCxxExceptionMessage(const char* description,
function Result (line 2417) | Result HandleSehExceptionsInMethodIfSupported(
function Result (line 2444) | Result HandleExceptionsInMethodIfSupported(
function TestInfo (line 2584) | TestInfo* MakeAndRegisterTestInfo(
function ReportInvalidTestSuiteType (line 2596) | void ReportInvalidTestSuiteType(const char* test_suite_name,
function PrintTestPartResultToString (line 2903) | static std::string PrintTestPartResultToString(
function PrintTestPartResult (line 2913) | static void PrintTestPartResult(const TestPartResult& test_part_result) {
function WORD (line 2936) | static WORD GetColorAttribute(GTestColor color) {
function GetBitOffset (line 2945) | static int GetBitOffset(WORD color_mask) {
function WORD (line 2956) | static WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
function ShouldUseColor (line 2993) | bool ShouldUseColor(bool stdout_is_tty) {
function ColoredPrintf (line 3033) | void ColoredPrintf(GTestColor color, const char* fmt, ...) {
function PrintFullTestCommentIfPresent (line 3086) | static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
class PrettyUnitTestResultPrinter (line 3105) | class PrettyUnitTestResultPrinter : public TestEventListener {
method PrettyUnitTestResultPrinter (line 3107) | PrettyUnitTestResultPrinter() {}
method PrintTestName (line 3108) | static void PrintTestName(const char* test_suite, const char* test) {
method OnTestProgramStart (line 3113) | void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsSetUpEnd (line 3116) | void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
method OnEnvironmentsTearDownEnd (line 3134) | void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) overri...
method OnTestProgramEnd (line 3136) | void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
class TestEventRepeater (line 3388) | class TestEventRepeater : public TestEventListener {
method TestEventRepeater (line 3390) | TestEventRepeater() : forwarding_enabled_(true) {}
method forwarding_enabled (line 3397) | bool forwarding_enabled() const { return forwarding_enabled_; }
method set_forwarding_enabled (line 3398) | void set_forwarding_enabled(bool enable) { forwarding_enabled_ = ena...
function TestEventListener (line 3440) | TestEventListener* TestEventRepeater::Release(TestEventListener *liste...
class XmlUnitTestResultPrinter (line 3516) | class XmlUnitTestResultPrinter : public EmptyTestEventListener {
method IsNormalizableWhitespace (line 3530) | static bool IsNormalizableWhitespace(char c) {
method IsValidXmlCharacter (line 3535) | static bool IsValidXmlCharacter(char c) {
method EscapeXmlAttribute (line 3549) | static std::string EscapeXmlAttribute(const std::string& str) {
method EscapeXmlText (line 3554) | static std::string EscapeXmlText(const char* str) {
function FormatTimeInMillisAsSeconds (line 3710) | std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) {
function PortableLocaltime (line 3716) | static bool PortableLocaltime(time_t seconds, struct tm* out) {
function FormatEpochTimeInMillisAsIso8601 (line 3733) | std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) {
class JsonUnitTestResultPrinter (line 3982) | class JsonUnitTestResultPrinter : public EmptyTestEventListener {
function FormatTimeInMillisAsDuration (line 4096) | static std::string FormatTimeInMillisAsDuration(TimeInMillis ms) {
function FormatEpochTimeInMillisAsRFC3339 (line 4104) | static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) {
function Indent (line 4117) | static inline std::string Indent(size_t width) {
function GTEST_LOCK_EXCLUDED_ (line 4432) | GTEST_LOCK_EXCLUDED_(mutex_) {
function GTEST_LOCK_EXCLUDED_ (line 4481) | GTEST_LOCK_EXCLUDED_(mutex_) {
class ScopedPrematureExitFile (line 4495) | class ScopedPrematureExitFile {
method ScopedPrematureExitFile (line 4497) | explicit ScopedPrematureExitFile(const char* premature_exit_filepath)
class TestSuiteNameIs (line 5157) | class TestSuiteNameIs {
method TestSuiteNameIs (line 5160) | explicit TestSuiteNameIs(const std::string& name) : name_(name) {}
function TestSuite (line 5184) | TestSuite* UnitTestImpl::GetTestSuite(
function SetUpEnvironment (line 5220) | static void SetUpEnvironment(Environment* env) { env->SetUp(); }
function TearDownEnvironment (line 5221) | static void TearDownEnvironment(Environment* env) { env->TearDown(); }
function WriteToShardStatusFileIfNeeded (line 5399) | void WriteToShardStatusFileIfNeeded() {
function ShouldShard (line 5421) | bool ShouldShard(const char* total_shards_env,
function Int32 (line 5466) | Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
function ShouldRunTestOnShard (line 5484) | bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_...
function PrintOnOneLine (line 5550) | static void PrintOnOneLine(const char* str, int max_length) {
function OsStackTraceGetterInterface (line 5637) | OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() {
function TestResult (line 5650) | TestResult* UnitTestImpl::current_test_result() {
function GetCurrentOsStackTraceExceptTop (line 5696) | std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/,
class ClassUniqueToAlwaysTrue (line 5706) | class ClassUniqueToAlwaysTrue {}
function IsTrue (line 5709) | bool IsTrue(bool condition) { return condition; }
function AlwaysTrue (line 5711) | bool AlwaysTrue() {
function SkipPrefix (line 5724) | bool SkipPrefix(const char* prefix, const char** pstr) {
function ParseBoolFlag (line 5775) | static bool ParseBoolFlag(const char* str, const char* flag, bool* val...
function ParseInt32Flag (line 5792) | bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
function ParseStringFlag (line 5810) | static bool ParseStringFlag(const char* str, const char* flag, String*...
function HasGoogleTestFlagPrefix (line 5828) | static bool HasGoogleTestFlagPrefix(const char* str) {
function PrintColorEncoded (line 5846) | static void PrintColorEncoded(const char* str) {
function ParseGoogleTestFlag (line 5945) | static bool ParseGoogleTestFlag(const char* const arg) {
function LoadFlagsFromFile (line 5976) | static void LoadFlagsFromFile(const std::string& path) {
function ParseGoogleTestFlagsOnlyImpl (line 5999) | void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
function ParseGoogleTestFlagsOnly (line 6052) | void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
function ParseGoogleTestFlagsOnly (line 6066) | void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
function InitGoogleTestImpl (line 6075) | void InitGoogleTestImpl(int* argc, CharType** argv) {
function InitGoogleTest (line 6105) | void InitGoogleTest(int* argc, char** argv) {
function InitGoogleTest (line 6115) | void InitGoogleTest(int* argc, wchar_t** argv) {
function InitGoogleTest (line 6125) | void InitGoogleTest() {
function TempDir (line 6139) | std::string TempDir() {
function GTEST_LOCK_EXCLUDED_ (line 6176) | GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
FILE: test/googletest/src/gtest_main.cc
function setup (line 37) | void setup() {
function loop (line 41) | void loop() { RUN_ALL_TESTS(); }
function GTEST_API_ (line 49) | GTEST_API_ int main(int argc, char **argv) {
FILE: test/googletest/test/googletest-break-on-failure-unittest.py
function Run (line 76) | def Run(command):
class GTestBreakOnFailureUnitTest (line 89) | class GTestBreakOnFailureUnitTest(gtest_test_utils.TestCase):
method RunAndVerify (line 95) | def RunAndVerify(self, env_var_value, flag_value, expect_seg_fault):
method testDefaultBehavior (line 140) | def testDefaultBehavior(self):
method testEnvVar (line 147) | def testEnvVar(self):
method testFlag (line 157) | def testFlag(self):
method testFlagOverridesEnvVar (line 167) | def testFlagOverridesEnvVar(self):
method testBreakOnFailureOverridesThrowOnFailure (line 183) | def testBreakOnFailureOverridesThrowOnFailure(self):
method testCatchExceptionsDoesNotInterfere (line 195) | def testCatchExceptionsDoesNotInterfere(self):
FILE: test/googletest/test/googletest-break-on-failure-unittest_.cc
function TEST (line 51) | TEST(Foo, Bar) {
function LONG (line 57) | LONG WINAPI ExitWithExceptionCode(
function main (line 65) | int main(int argc, char **argv) {
FILE: test/googletest/test/googletest-catch-exceptions-test.py
class CatchSehExceptionsTest (line 81) | class CatchSehExceptionsTest(gtest_test_utils.TestCase):
method TestSehExceptions (line 85) | def TestSehExceptions(self, test_output):
method testCatchesSehExceptionsWithCxxExceptionsEnabled (line 103) | def testCatchesSehExceptionsWithCxxExceptionsEnabled(self):
method testCatchesSehExceptionsWithCxxExceptionsDisabled (line 106) | def testCatchesSehExceptionsWithCxxExceptionsDisabled(self):
class CatchCxxExceptionsTest (line 110) | class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
method testCatchesCxxExceptionsInFixtureConstructor (line 119) | def testCatchesCxxExceptionsInFixtureConstructor(self):
method testCatchesCxxExceptionsInFixtureDestructor (line 133) | def testCatchesCxxExceptionsInFixtureDestructor(self):
method testCatchesCxxExceptionsInSetUpTestCase (line 143) | def testCatchesCxxExceptionsInSetUpTestCase(self):
method testCatchesCxxExceptionsInTearDownTestCase (line 166) | def testCatchesCxxExceptionsInTearDownTestCase(self):
method testCatchesCxxExceptionsInSetUp (line 171) | def testCatchesCxxExceptionsInSetUp(self):
method testCatchesCxxExceptionsInTearDown (line 189) | def testCatchesCxxExceptionsInTearDown(self):
method testCatchesCxxExceptionsInTestBody (line 200) | def testCatchesCxxExceptionsInTestBody(self):
method testCatchesNonStdCxxExceptions (line 214) | def testCatchesNonStdCxxExceptions(self):
method testUnhandledCxxExceptionsAbortTheProgram (line 219) | def testUnhandledCxxExceptionsAbortTheProgram(self):
FILE: test/googletest/test/googletest-catch-exceptions-test_.cc
class SehExceptionInConstructorTest (line 53) | class SehExceptionInConstructorTest : public Test {
method SehExceptionInConstructorTest (line 55) | SehExceptionInConstructorTest() { RaiseException(42, 0, 0, NULL); }
function TEST_F (line 58) | TEST_F(SehExceptionInConstructorTest, ThrowsExceptionInConstructor) {}
class SehExceptionInDestructorTest (line 60) | class SehExceptionInDestructorTest : public Test {
function TEST_F (line 65) | TEST_F(SehExceptionInDestructorTest, ThrowsExceptionInDestructor) {}
class SehExceptionInSetUpTestSuiteTest (line 67) | class SehExceptionInSetUpTestSuiteTest : public Test {
method SetUpTestSuite (line 69) | static void SetUpTestSuite() { RaiseException(42, 0, 0, NULL); }
function TEST_F (line 72) | TEST_F(SehExceptionInSetUpTestSuiteTest, ThrowsExceptionInSetUpTestSuite...
class SehExceptionInTearDownTestSuiteTest (line 74) | class SehExceptionInTearDownTestSuiteTest : public Test {
method TearDownTestSuite (line 76) | static void TearDownTestSuite() { RaiseException(42, 0, 0, NULL); }
function TEST_F (line 79) | TEST_F(SehExceptionInTearDownTestSuiteTest,
class SehExceptionInSetUpTest (line 82) | class SehExceptionInSetUpTest : public Test {
method SetUp (line 84) | virtual void SetUp() { RaiseException(42, 0, 0, NULL); }
function TEST_F (line 87) | TEST_F(SehExceptionInSetUpTest, ThrowsExceptionInSetUp) {}
class SehExceptionInTearDownTest (line 89) | class SehExceptionInTearDownTest : public Test {
method TearDown (line 91) | virtual void TearDown() { RaiseException(42, 0, 0, NULL); }
function TEST_F (line 94) | TEST_F(SehExceptionInTearDownTest, ThrowsExceptionInTearDown) {}
function TEST (line 96) | TEST(SehExceptionTest, ThrowsSehException) {
class CxxExceptionInConstructorTest (line 104) | class CxxExceptionInConstructorTest : public Test {
method CxxExceptionInConstructorTest (line 106) | CxxExceptionInConstructorTest() {
method TearDownTestSuite (line 113) | static void TearDownTestSuite() {
method SetUp (line 125) | void SetUp() override {
method TearDown (line 130) | void TearDown() override {
function TEST_F (line 136) | TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) {
class CxxExceptionInSetUpTestSuiteTest (line 141) | class CxxExceptionInSetUpTestSuiteTest : public Test {
method CxxExceptionInSetUpTestSuiteTest (line 143) | CxxExceptionInSetUpTestSuiteTest() {
method SetUpTestSuite (line 149) | static void SetUpTestSuite() {
method TearDownTestSuite (line 153) | static void TearDownTestSuite() {
method SetUp (line 166) | void SetUp() override {
method TearDown (line 172) | void TearDown() override {
function TEST_F (line 179) | TEST_F(CxxExceptionInSetUpTestSuiteTest, ThrowsExceptionInSetUpTestSuite) {
class CxxExceptionInTearDownTestSuiteTest (line 185) | class CxxExceptionInTearDownTestSuiteTest : public Test {
method TearDownTestSuite (line 187) | static void TearDownTestSuite() {
function TEST_F (line 192) | TEST_F(CxxExceptionInTearDownTestSuiteTest,
class CxxExceptionInSetUpTest (line 195) | class CxxExceptionInSetUpTest : public Test {
method TearDownTestSuite (line 197) | static void TearDownTestSuite() {
method SetUp (line 210) | void SetUp() override { throw std::runtime_error("Standard C++ excepti...
method TearDown (line 212) | void TearDown() override {
function TEST_F (line 219) | TEST_F(CxxExceptionInSetUpTest, ThrowsExceptionInSetUp) {
class CxxExceptionInTearDownTest (line 224) | class CxxExceptionInTearDownTest : public Test {
method TearDownTestSuite (line 226) | static void TearDownTestSuite() {
method TearDown (line 239) | void TearDown() override {
function TEST_F (line 244) | TEST_F(CxxExceptionInTearDownTest, ThrowsExceptionInTearDown) {}
class CxxExceptionInTestBodyTest (line 246) | class CxxExceptionInTestBodyTest : public Test {
method TearDownTestSuite (line 248) | static void TearDownTestSuite() {
method TearDown (line 261) | void TearDown() override {
function TEST_F (line 268) | TEST_F(CxxExceptionInTestBodyTest, ThrowsStdCxxException) {
function TEST (line 272) | TEST(CxxExceptionTest, ThrowsNonStdCxxException) {
function TerminateHandler (line 279) | void TerminateHandler() {
function main (line 287) | int main(int argc, char** argv) {
FILE: test/googletest/test/googletest-color-test.py
function SetEnvVar (line 44) | def SetEnvVar(env_var, value):
function UsesColor (line 53) | def UsesColor(term, color_env_var, color_flag):
class GTestColorTest (line 67) | class GTestColorTest(gtest_test_utils.TestCase):
method testNoEnvVarNoFlag (line 68) | def testNoEnvVarNoFlag(self):
method testFlagOnly (line 83) | def testFlagOnly(self):
method testEnvVarOnly (line 94) | def testEnvVarOnly(self):
method testEnvVarAndFlag (line 105) | def testEnvVarAndFlag(self):
method testAliasesOfYesAndNo (line 112) | def testAliasesOfYesAndNo(self):
FILE: test/googletest/test/googletest-color-test_.cc
function TEST (line 46) | TEST(GTestColorTest, Dummy) {
function main (line 49) | int main(int argc, char** argv) {
FILE: test/googletest/test/googletest-death-test-test.cc
type testing (line 76) | namespace testing {
type internal (line 77) | namespace internal {
class ReplaceDeathTestFactory (line 81) | class ReplaceDeathTestFactory {
method ReplaceDeathTestFactory (line 83) | explicit ReplaceDeathTestFactory(DeathTestFactory* new_factory)
function DieWithMessage (line 107) | void DieWithMessage(const ::std::string& message) {
function DieInside (line 123) | void DieInside(const ::std::string& function) {
class TestForDeathTest (line 129) | class TestForDeathTest : public testing::Test {
method TestForDeathTest (line 131) | TestForDeathTest() : original_dir_(FilePath::GetCurrentDir()) {}
method StaticMemberFunction (line 136) | static void StaticMemberFunction() { DieInside("StaticMemberFunction"); }
method MemberFunction (line 139) | void MemberFunction() {
class MayDie (line 150) | class MayDie {
method MayDie (line 152) | explicit MayDie(bool should_die) : should_die_(should_die) {}
method MemberFunction (line 155) | void MemberFunction() const {
function GlobalFunction (line 166) | void GlobalFunction() { DieInside("GlobalFunction"); }
function NonVoidFunction (line 169) | int NonVoidFunction() {
function DieIf (line 175) | void DieIf(bool should_die) {
function DieIfLessThan (line 181) | bool DieIfLessThan(int x, int y) {
function DeathTestSubroutine (line 189) | void DeathTestSubroutine() {
function DieInDebugElse12 (line 195) | int DieInDebugElse12(int* sideeffect) {
function DieInCRTDebugElse12 (line 210) | int DieInCRTDebugElse12(int* sideeffect) {
function TEST (line 230) | TEST(ExitStatusPredicateTest, ExitedWithCode) {
function NormalExitStatus (line 245) | static int NormalExitStatus(int exit_code) {
function KilledExitStatus (line 260) | static int KilledExitStatus(int signum) {
function TEST (line 272) | TEST(ExitStatusPredicateTest, ExitedWithCode) {
function TEST (line 288) | TEST(ExitStatusPredicateTest, KilledBySignal) {
function TEST_F (line 304) | TEST_F(TestForDeathTest, SingleStatement) {
function DieWithEmbeddedNul (line 327) | void DieWithEmbeddedNul() {
function TEST_F (line 335) | TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
function TEST_F (line 344) | TEST_F(TestForDeathTest, SwitchStatement) {
function TEST_F (line 362) | TEST_F(TestForDeathTest, StaticMemberFunctionFastStyle) {
function TEST_F (line 369) | TEST_F(TestForDeathTest, MemberFunctionFastStyle) {
function ChangeToRootDir (line 375) | void ChangeToRootDir() { posix::ChDir(GTEST_PATH_SEP_); }
function TEST_F (line 379) | TEST_F(TestForDeathTest, FastDeathTestInChangedDir) {
function SigprofAction (line 390) | void SigprofAction(int, siginfo_t*, void*) { /* no op */ }
function SetSigprofActionAndTimer (line 393) | void SetSigprofActionAndTimer() {
function DisableSigprofActionAndTimer (line 408) | void DisableSigprofActionAndTimer(struct sigaction* old_signal_action) {
function TEST_F (line 422) | TEST_F(TestForDeathTest, FastSigprofActionSet) {
function TEST_F (line 431) | TEST_F(TestForDeathTest, ThreadSafeSigprofActionSet) {
function TEST_F (line 443) | TEST_F(TestForDeathTest, StaticMemberFunctionThreadsafeStyle) {
function TEST_F (line 448) | TEST_F(TestForDeathTest, MemberFunctionThreadsafeStyle) {
function TEST_F (line 454) | TEST_F(TestForDeathTest, ThreadsafeDeathTestInLoop) {
function TEST_F (line 461) | TEST_F(TestForDeathTest, ThreadsafeDeathTestInChangedDir) {
function TEST_F (line 471) | TEST_F(TestForDeathTest, MixedStyles) {
function SetPthreadFlag (line 482) | void SetPthreadFlag() {
function TEST_F (line 486) | TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
function TEST_F (line 499) | TEST_F(TestForDeathTest, MethodOfAnotherClass) {
function TEST_F (line 505) | TEST_F(TestForDeathTest, GlobalFunction) {
function TEST_F (line 511) | TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {
function TEST_F (line 531) | TEST_F(TestForDeathTest, NonVoidFunction) {
function TEST_F (line 536) | TEST_F(TestForDeathTest, FunctionWithParameter) {
function TEST_F (line 542) | TEST_F(TestForDeathTest, OutsideFixture) {
function TEST_F (line 547) | TEST_F(TestForDeathTest, InsideLoop) {
function TEST_F (line 554) | TEST_F(TestForDeathTest, CompoundStatement) {
function TEST_F (line 564) | TEST_F(TestForDeathTest, DoesNotDie) {
function TEST_F (line 570) | TEST_F(TestForDeathTest, ErrorMessageMismatch) {
function ExpectDeathTestHelper (line 578) | void ExpectDeathTestHelper(bool* aborted) {
function TEST_F (line 585) | TEST_F(TestForDeathTest, EXPECT_DEATH) {
function TEST_F (line 593) | TEST_F(TestForDeathTest, ASSERT_DEATH) {
function TEST_F (line 604) | TEST_F(TestForDeathTest, SingleEvaluation) {
function TEST_F (line 615) | TEST_F(TestForDeathTest, RunawayIsFailure) {
function TEST_F (line 622) | TEST_F(TestForDeathTest, ReturnIsFailure) {
function TEST_F (line 634) | TEST_F(TestForDeathTest, TestExpectDebugDeath) {
function TEST_F (line 666) | TEST_F(TestForDeathTest, CRTDebugDeath) {
function TEST_F (line 698) | TEST_F(TestForDeathTest, TestAssertDebugDeath) {
function ExpectDebugDeathHelper (line 719) | void ExpectDebugDeathHelper(bool* aborted) {
function TEST (line 726) | TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {
function TEST_F (line 740) | TEST_F(TestForDeathTest, ExpectDebugDeathDoesNotAbort) {
function AssertDebugDeathHelper (line 746) | void AssertDebugDeathHelper(bool* aborted) {
function TEST_F (line 757) | TEST_F(TestForDeathTest, AssertDebugDeathAborts) {
function TEST_F (line 764) | TEST_F(TestForDeathTest, AssertDebugDeathAborts2) {
function TEST_F (line 771) | TEST_F(TestForDeathTest, AssertDebugDeathAborts3) {
function TEST_F (line 778) | TEST_F(TestForDeathTest, AssertDebugDeathAborts4) {
function TEST_F (line 785) | TEST_F(TestForDeathTest, AssertDebugDeathAborts5) {
function TEST_F (line 792) | TEST_F(TestForDeathTest, AssertDebugDeathAborts6) {
function TEST_F (line 799) | TEST_F(TestForDeathTest, AssertDebugDeathAborts7) {
function TEST_F (line 806) | TEST_F(TestForDeathTest, AssertDebugDeathAborts8) {
function TEST_F (line 813) | TEST_F(TestForDeathTest, AssertDebugDeathAborts9) {
function TEST_F (line 820) | TEST_F(TestForDeathTest, AssertDebugDeathAborts10) {
function TestExitMacros (line 830) | static void TestExitMacros() {
function TEST_F (line 860) | TEST_F(TestForDeathTest, ExitMacros) {
function TEST_F (line 864) | TEST_F(TestForDeathTest, ExitMacrosUsingFork) {
function TEST_F (line 869) | TEST_F(TestForDeathTest, InvalidStyle) {
function TEST_F (line 876) | TEST_F(TestForDeathTest, DeathTestFailedOutput) {
function TEST_F (line 885) | TEST_F(TestForDeathTest, DeathTestUnexpectedReturnOutput) {
function TEST_F (line 898) | TEST_F(TestForDeathTest, DeathTestBadExitCodeOutput) {
function TEST_F (line 910) | TEST_F(TestForDeathTest, DeathTestMultiLineMatchFail) {
function TEST_F (line 921) | TEST_F(TestForDeathTest, DeathTestMultiLineMatchPass) {
class MockDeathTestFactory (line 928) | class MockDeathTestFactory : public DeathTestFactory {
method AssumeRoleCalls (line 940) | int AssumeRoleCalls() const { return assume_role_calls_; }
method WaitCalls (line 941) | int WaitCalls() const { return wait_calls_; }
method PassedCalls (line 942) | size_t PassedCalls() const { return passed_args_.size(); }
method PassedArgument (line 943) | bool PassedArgument(int n) const {
method AbortCalls (line 946) | size_t AbortCalls() const { return abort_args_.size(); }
method AbortArgument (line 947) | DeathTest::AbortReason AbortArgument(int n) const {
method TestDeleted (line 950) | bool TestDeleted() const { return test_deleted_; }
class MockDeathTest (line 984) | class MockDeathTest : public DeathTest {
method MockDeathTest (line 986) | MockDeathTest(MockDeathTestFactory *parent,
method TestRole (line 991) | TestRole AssumeRole() override {
method Wait (line 995) | int Wait() override {
method Passed (line 999) | bool Passed(bool exit_status_ok) override {
method Abort (line 1003) | void Abort(AbortReason reason) override {
class MacroLogicDeathTest (line 1062) | class MacroLogicDeathTest : public testing::Test {
method SetUpTestSuite (line 1067) | static void SetUpTestSuite() {
method TearDownTestSuite (line 1072) | static void TearDownTestSuite() {
method RunReturningDeathTest (line 1082) | static void RunReturningDeathTest(bool* flag) {
function TEST_F (line 1095) | TEST_F(MacroLogicDeathTest, NothingHappens) {
function TEST_F (line 1110) | TEST_F(MacroLogicDeathTest, ChildExitsSuccessfully) {
function TEST_F (line 1125) | TEST_F(MacroLogicDeathTest, ChildExitsUnsuccessfully) {
function TEST_F (line 1141) | TEST_F(MacroLogicDeathTest, ChildPerformsReturn) {
function TEST_F (line 1157) | TEST_F(MacroLogicDeathTest, ChildDoesNotDie) {
function TEST (line 1180) | TEST(SuccessRegistrationDeathTest, NoSuccessPart) {
function TEST (line 1185) | TEST(StreamingAssertionsDeathTest, DeathTest) {
function TEST (line 1198) | TEST(GetLastErrnoDescription, GetLastErrnoDescriptionWorks) {
function TEST (line 1206) | TEST(AutoHandleTest, AutoHandleWorks) {
function TEST (line 1245) | TEST(ParseNaturalNumberTest, RejectsInvalidFormat) {
function TEST (line 1262) | TEST(ParseNaturalNumberTest, RejectsOverflownNumbers) {
function TEST (line 1272) | TEST(ParseNaturalNumberTest, AcceptsValidNumbers) {
function TEST (line 1289) | TEST(ParseNaturalNumberTest, AcceptsTypeLimits) {
function TEST (line 1319) | TEST(ParseNaturalNumberTest, WorksForShorterIntegers) {
function TEST (line 1330) | TEST(EnvironmentTest, HandleFitsIntoSizeT) {
function TEST (line 1337) | TEST(ConditionalDeathMacrosDeathTest, ExpectsDeathWhenDeathTestsAvailabl...
function TEST (line 1348) | TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInFastStyle) {
function TEST (line 1358) | TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInThreadSafeSty...
function DieWithMessage (line 1368) | void DieWithMessage(const char* message) {
function TEST (line 1374) | TEST(MatcherDeathTest, DoesNotBreakBareRegexMatching) {
function TEST (line 1380) | TEST(MatcherDeathTest, MonomorphicMatcherMatches) {
function TEST (line 1385) | TEST(MatcherDeathTest, MonomorphicMatcherDoesNotMatch) {
function TEST (line 1393) | TEST(MatcherDeathTest, PolymorphicMatcherMatches) {
function TEST (line 1398) | TEST(MatcherDeathTest, PolymorphicMatcherDoesNotMatch) {
function TEST (line 1417) | TEST(ConditionalDeathMacrosTest, WarnsWhenDeathTestsNotAvailable) {
function FuncWithAssert (line 1446) | void FuncWithAssert(int* n) {
function TEST (line 1453) | TEST(ConditionalDeathMacrosTest, AssertDeatDoesNotReturnhIfUnsupported) {
function TEST (line 1470) | TEST(ConditionalDeathMacrosSyntaxDeathTest, SingleStatement) {
function TEST (line 1493) | TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {
function TEST (line 1512) | TEST(NotADeathTest, Test) {
FILE: test/googletest/test/googletest-death-test_ex_test.cc
function TEST (line 50) | TEST(CxxExceptionDeathTest, ExceptionIsFailure) {
class TestException (line 60) | class TestException : public std::exception {
function TEST (line 65) | TEST(CxxExceptionDeathTest, PrintsMessageForStdExceptions) {
function TEST (line 79) | TEST(SehExceptionDeasTest, CatchExceptionsDoesNotInterfere) {
function main (line 88) | int main(int argc, char** argv) {
FILE: test/googletest/test/googletest-env-var-test.py
function AssertEq (line 46) | def AssertEq(expected, actual):
function SetEnvVar (line 53) | def SetEnvVar(env_var, value):
function GetFlag (line 62) | def GetFlag(flag):
function TestFlag (line 71) | def TestFlag(flag, test_val, default_val):
class GTestEnvVarTest (line 81) | class GTestEnvVarTest(gtest_test_utils.TestCase):
method testEnvVarAffectsFlag (line 83) | def testEnvVarAffectsFlag(self):
method testXmlOutputFile (line 102) | def testXmlOutputFile(self):
method testXmlOutputFileOverride (line 109) | def testXmlOutputFileOverride(self):
FILE: test/googletest/test/googletest-env-var-test_.cc
type testing (line 41) | namespace testing {
function TEST (line 46) | TEST(GTestEnvVarTest, Dummy) {
function PrintFlag (line 49) | void PrintFlag(const char* flag) {
function main (line 112) | int main(int argc, char** argv) {
FILE: test/googletest/test/googletest-filepath-test.cc
type testing (line 48) | namespace testing {
type internal (line 49) | namespace internal {
function remove (line 55) | int remove(const char* path) {
function _rmdir (line 62) | int _rmdir(const char* path) {
function TEST (line 73) | TEST(GetCurrentDirTest, ReturnsCurrentDir) {
function TEST (line 97) | TEST(IsEmptyTest, ReturnsTrueForEmptyPath) {
function TEST (line 101) | TEST(IsEmptyTest, ReturnsFalseForNonEmptyPath) {
function TEST (line 109) | TEST(RemoveDirectoryNameTest, WhenEmptyName) {
function TEST (line 114) | TEST(RemoveDirectoryNameTest, ButNoDirectory) {
function TEST (line 120) | TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileName) {
function TEST (line 126) | TEST(RemoveDirectoryNameTest, WhereThereIsNoFileName) {
function TEST (line 132) | TEST(RemoveDirectoryNameTest, ShouldGiveFileName) {
function TEST (line 138) | TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
function TEST (line 150) | TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileNameForAlternate...
function TEST (line 155) | TEST(RemoveDirectoryNameTest, WhereThereIsNoFileNameForAlternateSepa...
function TEST (line 160) | TEST(RemoveDirectoryNameTest, ShouldGiveFileNameForAlternateSeparato...
function TEST (line 165) | TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileNameForAlternateSepa...
function TEST (line 173) | TEST(RemoveFileNameTest, EmptyName) {
function TEST (line 183) | TEST(RemoveFileNameTest, ButNoFile) {
function TEST (line 189) | TEST(RemoveFileNameTest, GivesDirName) {
function TEST (line 195) | TEST(RemoveFileNameTest, GivesDirAndSubDirName) {
function TEST (line 202) | TEST(RemoveFileNameTest, GivesRootDir) {
function TEST (line 213) | TEST(RemoveFileNameTest, ButNoFileForAlternateSeparator) {
function TEST (line 219) | TEST(RemoveFileNameTest, GivesDirNameForAlternateSeparator) {
function TEST (line 225) | TEST(RemoveFileNameTest, GivesDirAndSubDirNameForAlternateSeparator) {
function TEST (line 231) | TEST(RemoveFileNameTest, GivesRootDirForAlternateSeparator) {
function TEST (line 237) | TEST(MakeFileNameTest, GenerateWhenNumberIsZero) {
function TEST (line 243) | TEST(MakeFileNameTest, GenerateFileNameNumberGtZero) {
function TEST (line 249) | TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberIsZero) {
function TEST (line 255) | TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberGtZero) {
function TEST (line 261) | TEST(MakeFileNameTest, GenerateWhenNumberIsZeroAndDirIsEmpty) {
function TEST (line 267) | TEST(MakeFileNameTest, GenerateWhenNumberIsNotZeroAndDirIsEmpty) {
function TEST (line 273) | TEST(ConcatPathsTest, WorksWhenDirDoesNotEndWithPathSep) {
function TEST (line 279) | TEST(ConcatPathsTest, WorksWhenPath1EndsWithPathSep) {
function TEST (line 285) | TEST(ConcatPathsTest, Path1BeingEmpty) {
function TEST (line 291) | TEST(ConcatPathsTest, Path2BeingEmpty) {
function TEST (line 296) | TEST(ConcatPathsTest, BothPathBeingEmpty) {
function TEST (line 302) | TEST(ConcatPathsTest, Path1ContainsPathSep) {
function TEST (line 309) | TEST(ConcatPathsTest, Path2ContainsPathSep) {
function TEST (line 317) | TEST(ConcatPathsTest, Path2EndsWithPathSep) {
function TEST (line 324) | TEST(RemoveTrailingPathSeparatorTest, EmptyString) {
function TEST (line 329) | TEST(RemoveTrailingPathSeparatorTest, FileNoSlashString) {
function TEST (line 334) | TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveTrailingSeparator) {
function TEST (line 343) | TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveLastSeparator) {
function TEST (line 350) | TEST(RemoveTrailingPathSeparatorTest, ShouldReturnUnmodified) {
function TEST (line 356) | TEST(DirectoryTest, RootDirectoryExists) {
function TEST (line 370) | TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
function TEST (line 389) | TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
function TEST (line 394) | TEST(DirectoryTest, CurrentDirectoryExists) {
function TEST (line 409) | TEST(NormalizeTest, MultipleConsecutiveSepaparatorsInMidstring) {
function TEST (line 420) | TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringStart) {
function TEST (line 430) | TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) {
function TEST (line 444) | TEST(NormalizeTest, MixAlternateSeparatorAtStringEnd) {
function TEST (line 455) | TEST(AssignmentOperatorTest, DefaultAssignedToNonDefault) {
function TEST (line 463) | TEST(AssignmentOperatorTest, NonDefaultAssignedToDefault) {
function TEST (line 471) | TEST(AssignmentOperatorTest, ConstAssignedToNonConst) {
class DirectoryCreationTest (line 478) | class DirectoryCreationTest : public Test {
method SetUp (line 480) | void SetUp() override {
method TearDown (line 497) | void TearDown() override {
method CreateTextFile (line 504) | void CreateTextFile(const char* filename) {
function TEST_F (line 519) | TEST_F(DirectoryCreationTest, CreateDirectoriesRecursively) {
function TEST_F (line 525) | TEST_F(DirectoryCreationTest, CreateDirectoriesForAlreadyExistingPat...
function TEST_F (line 532) | TEST_F(DirectoryCreationTest, CreateDirectoriesAndUniqueFilename) {
function TEST_F (line 551) | TEST_F(DirectoryCreationTest, CreateDirectoriesFail) {
function TEST (line 559) | TEST(NoDirectoryCreationTest, CreateNoDirectoriesForDefaultXmlFile) {
function TEST (line 564) | TEST(FilePathTest, DefaultConstructor) {
function TEST (line 569) | TEST(FilePathTest, CharAndCopyConstructors) {
function TEST (line 577) | TEST(FilePathTest, StringConstructor) {
function TEST (line 582) | TEST(FilePathTest, Set) {
function TEST (line 590) | TEST(FilePathTest, ToString) {
function TEST (line 595) | TEST(FilePathTest, RemoveExtension) {
function TEST (line 601) | TEST(FilePathTest, RemoveExtensionWhenThereIsNoExtension) {
function TEST (line 605) | TEST(FilePathTest, IsDirectory) {
function TEST (line 613) | TEST(FilePathTest, IsAbsolutePath) {
function TEST (line 628) | TEST(FilePathTest, IsRootDirectory) {
FILE: test/googletest/test/googletest-filter-unittest.py
function SetEnvVar (line 174) | def SetEnvVar(env_var, value):
function RunAndReturnOutput (line 183) | def RunAndReturnOutput(args = None):
function RunAndExtractTestList (line 190) | def RunAndExtractTestList(args = None):
function InvokeWithModifiedEnv (line 209) | def InvokeWithModifiedEnv(extra_env, function, *args, **kwargs):
function RunWithSharding (line 220) | def RunWithSharding(total_shards, shard_index, command):
class GTestFilterUnitTest (line 230) | class GTestFilterUnitTest(gtest_test_utils.TestCase):
method AssertSetEqual (line 235) | def AssertSetEqual(self, lhs, rhs):
method AssertPartitionIsValid (line 244) | def AssertPartitionIsValid(self, set_var, list_of_sets):
method AdjustForParameterizedTests (line 253) | def AdjustForParameterizedTests(self, tests_to_run):
method RunAndVerify (line 262) | def RunAndVerify(self, gtest_filter, tests_to_run):
method RunAndVerifyWithSharding (line 292) | def RunAndVerifyWithSharding(self, gtest_filter, total_shards, tests_t...
method RunAndVerifyAllowingDisabled (line 331) | def RunAndVerifyAllowingDisabled(self, gtest_filter, tests_to_run):
method setUp (line 352) | def setUp(self):
method testDefaultBehavior (line 364) | def testDefaultBehavior(self):
method testDefaultBehaviorWithShards (line 369) | def testDefaultBehaviorWithShards(self):
method testEmptyFilter (line 378) | def testEmptyFilter(self):
method testBadFilter (line 385) | def testBadFilter(self):
method testFullName (line 391) | def testFullName(self):
method testUniversalFilters (line 398) | def testUniversalFilters(self):
method testFilterByTestCase (line 407) | def testFilterByTestCase(self):
method testFilterByTest (line 417) | def testFilterByTest(self):
method testFilterDisabledTests (line 422) | def testFilterDisabledTests(self):
method testWildcardInTestCaseName (line 447) | def testWildcardInTestCaseName(self):
method testWildcardInTestName (line 459) | def testWildcardInTestName(self):
method testFilterWithoutDot (line 464) | def testFilterWithoutDot(self):
method testTwoPatterns (line 475) | def testTwoPatterns(self):
method testThreePatterns (line 488) | def testThreePatterns(self):
method testNegativeFilters (line 517) | def testNegativeFilters(self):
method testFlagOverridesEnvVar (line 569) | def testFlagOverridesEnvVar(self):
method testShardStatusFileIsCreated (line 579) | def testShardStatusFileIsCreated(self):
method testShardStatusFileIsCreatedWithListTests (line 593) | def testShardStatusFileIsCreatedWithListTests(self):
method testShardingWorksWithDeathTests (line 617) | def testShardingWorksWithDeathTests(self):
FILE: test/googletest/test/googletest-filter-unittest_.cc
class FooTest (line 46) | class FooTest : public testing::Test {
function TEST_F (line 49) | TEST_F(FooTest, Abc) {
function TEST_F (line 52) | TEST_F(FooTest, Xyz) {
function TEST (line 58) | TEST(BarTest, TestOne) {
function TEST (line 61) | TEST(BarTest, TestTwo) {
function TEST (line 64) | TEST(BarTest, TestThree) {
function TEST (line 67) | TEST(BarTest, DISABLED_TestFour) {
function TEST (line 71) | TEST(BarTest, DISABLED_TestFive) {
function TEST (line 77) | TEST(BazTest, TestOne) {
function TEST (line 81) | TEST(BazTest, TestA) {
function TEST (line 84) | TEST(BazTest, TestB) {
function TEST (line 87) | TEST(BazTest, DISABLED_TestC) {
function TEST (line 93) | TEST(HasDeathTest, Test1) {
function TEST (line 99) | TEST(HasDeathTest, Test2) {
function TEST (line 105) | TEST(DISABLED_FoobarTest, Test1) {
function TEST (line 109) | TEST(DISABLED_FoobarTest, DISABLED_Test2) {
function TEST (line 115) | TEST(DISABLED_FoobarbazTest, TestA) {
class ParamTest (line 119) | class ParamTest : public testing::TestWithParam<int> {
function TEST_P (line 122) | TEST_P(ParamTest, TestX) {
function TEST_P (line 125) | TEST_P(ParamTest, TestY) {
function main (line 133) | int main(int argc, char **argv) {
FILE: test/googletest/test/googletest-json-outfiles-test.py
class GTestJsonOutFilesTest (line 131) | class GTestJsonOutFilesTest(gtest_test_utils.TestCase):
method setUp (line 134) | def setUp(self):
method tearDown (line 142) | def tearDown(self):
method DeleteFilesAndDir (line 145) | def DeleteFilesAndDir(self):
method testOutfile1 (line 159) | def testOutfile1(self):
method testOutfile2 (line 162) | def testOutfile2(self):
method _TestOutFile (line 165) | def _TestOutFile(self, test_name, expected):
FILE: test/googletest/test/googletest-json-output-unittest.py
class GTestJsonOutputUnitTest (line 606) | class GTestJsonOutputUnitTest(gtest_test_utils.TestCase):
method testNonEmptyJsonOutput (line 614) | def testNonEmptyJsonOutput(self):
method testEmptyJsonOutput (line 622) | def testEmptyJsonOutput(self):
method testTimestampValue (line 631) | def testTimestampValue(self):
method testDefaultOutputFile (line 655) | def testDefaultOutputFile(self):
method testSuppressedJsonOutput (line 679) | def testSuppressedJsonOutput(self):
method testFilteredTestJsonOutput (line 709) | def testFilteredTestJsonOutput(self):
method _GetJsonOutput (line 719) | def _GetJsonOutput(self, gtest_prog_name, extra_args, expected_exit_co...
method _TestJsonOutput (line 751) | def _TestJsonOutput(self, gtest_prog_name, expected,
FILE: test/googletest/test/googletest-list-tests-unittest.py
function Run (line 114) | def Run(args):
class GTestListTestsUnitTest (line 124) | class GTestListTestsUnitTest(gtest_test_utils.TestCase):
method RunAndVerify (line 127) | def RunAndVerify(self, flag_value, expected_output_re, other_flag):
method testDefaultBehavior (line 171) | def testDefaultBehavior(self):
method testFlag (line 178) | def testFlag(self):
method testOverrideNonFilterFlags (line 188) | def testOverrideNonFilterFlags(self):
method testWithFilterFlags (line 195) | def testWithFilterFlags(self):
FILE: test/googletest/test/googletest-list-tests-unittest_.cc
function TEST (line 43) | TEST(Foo, Bar1) {
function TEST (line 46) | TEST(Foo, Bar2) {
function TEST (line 49) | TEST(Foo, DISABLED_Bar3) {
function TEST (line 52) | TEST(Abc, Xyz) {
function TEST (line 55) | TEST(Abc, Def) {
function TEST (line 58) | TEST(FooBar, Baz) {
class FooTest (line 61) | class FooTest : public testing::Test {
function TEST_F (line 64) | TEST_F(FooTest, Test1) {
function TEST_F (line 67) | TEST_F(FooTest, DISABLED_Test2) {
function TEST_F (line 70) | TEST_F(FooTest, Test3) {
function TEST (line 73) | TEST(FooDeathTest, Test1) {
class MyType (line 78) | class MyType {
method MyType (line 80) | explicit MyType(const std::string& a_value) : value_(a_value) {}
function PrintTo (line 89) | void PrintTo(const MyType& x, std::ostream* os) {
class ValueParamTest (line 93) | class ValueParamTest : public testing::TestWithParam<MyType> {
function TEST_P (line 96) | TEST_P(ValueParamTest, TestA) {
function TEST_P (line 99) | TEST_P(ValueParamTest, TestB) {
class VeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogName (line 112) | class VeryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...
class TypedTest (line 116) | class TypedTest : public testing::Test {
class MyArray (line 120) | class MyArray {
function TYPED_TEST (line 128) | TYPED_TEST(TypedTest, TestA) {
function TYPED_TEST (line 131) | TYPED_TEST(TypedTest, TestB) {
class TypeParamTest (line 137) | class TypeParamTest : public testing::Test {
function TYPED_TEST_P (line 142) | TYPED_TEST_P(TypeParamTest, TestA) {
function TYPED_TEST_P (line 145) | TYPED_TEST_P(TypeParamTest, TestB) {
function main (line 152) | int main(int argc, char **argv) {
FILE: test/googletest/test/googletest-listener-test.cc
type testing (line 53) | namespace testing {
type internal (line 54) | namespace internal {
class EventRecordingListener (line 56) | class EventRecordingListener : public TestEventListener {
method EventRecordingListener (line 58) | explicit EventRecordingListener(const char* name) : name_(name) {}
method OnTestProgramStart (line 61) | void OnTestProgramStart(const UnitTest& /*unit_test*/) override {
method OnTestIterationStart (line 65) | void OnTestIterationStart(const UnitTest& /*unit_test*/,
method OnEnvironmentsSetUpStart (line 73) | void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) overr...
method OnEnvironmentsSetUpEnd (line 77) | void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {
method OnTestCaseStart (line 81) | void OnTestCaseStart(const TestCase& /*test_case*/) override {
method OnTestStart (line 86) | void OnTestStart(const TestInfo& /*test_info*/) override {
method OnTestPartResult (line 90) | void OnTestPartResult(const TestPartResult& /*test_part_result*/) ...
method OnTestEnd (line 94) | void OnTestEnd(const TestInfo& /*test_info*/) override {
method OnTestCaseEnd (line 99) | void OnTestCaseEnd(const TestCase& /*test_case*/) override {
method OnEnvironmentsTearDownStart (line 104) | void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) ov...
method OnEnvironmentsTearDownEnd (line 108) | void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) over...
method OnTestIterationEnd (line 112) | void OnTestIterationEnd(const UnitTest& /*unit_test*/,
method OnTestProgramEnd (line 120) | void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {
method GetFullMethodName (line 125) | std::string GetFullMethodName(const char* name) {
class EventRecordingListener2 (line 133) | class EventRecordingListener2 : public TestEventListener {
method EventRecordingListener2 (line 135) | explicit EventRecordingListener2(const char* name) : name_(name) {}
method OnTestProgramStart (line 138) | void OnTestProgramStart(const UnitTest& /*unit_test*/) override {
method OnTestIterationStart (line 142) | void OnTestIterationStart(const UnitTest& /*unit_test*/,
method OnEnvironmentsSetUpStart (line 150) | void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) overr...
method OnEnvironmentsSetUpEnd (line 154) | void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {
method OnTestSuiteStart (line 158) | void OnTestSuiteStart(const TestSuite& /*test_suite*/) override {
method OnTestStart (line 162) | void OnTestStart(const TestInfo& /*test_info*/) override {
method OnTestPartResult (line 166) | void OnTestPartResult(const TestPartResult& /*test_part_result*/) ...
method OnTestEnd (line 170) | void OnTestEnd(const TestInfo& /*test_info*/) override {
method OnTestSuiteEnd (line 174) | void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {
method OnEnvironmentsTearDownStart (line 178) | void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) ov...
method OnEnvironmentsTearDownEnd (line 182) | void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) over...
method OnTestIterationEnd (line 186) | void OnTestIterationEnd(const UnitTest& /*unit_test*/,
method OnTestProgramEnd (line 194) | void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {
method GetFullMethodName (line 199) | std::string GetFullMethodName(const char* name) { return name_ + "...
class EnvironmentInvocationCatcher (line 204) | class EnvironmentInvocationCatcher : public Environment {
method SetUp (line 206) | void SetUp() override { g_events->push_back("Environment::SetUp"); }
method TearDown (line 208) | void TearDown() override { g_events->push_back("Environment::TearD...
class ListenerTest (line 211) | class ListenerTest : public Test {
method SetUpTestSuite (line 213) | static void SetUpTestSuite() {
method TearDownTestSuite (line 217) | static void TearDownTestSuite() {
method SetUp (line 221) | void SetUp() override { g_events->push_back("ListenerTest::SetUp"); }
method TearDown (line 223) | void TearDown() override { g_events->push_back("ListenerTest::Tear...
function TEST_F (line 226) | TEST_F(ListenerTest, DoesFoo) {
function TEST_F (line 233) | TEST_F(ListenerTest, DoesBar) {
function VerifyResults (line 246) | void VerifyResults(const std::vector<std::string>& data,
function main (line 270) | int main(int argc, char **argv) {
FILE: test/googletest/test/googletest-message-test.cc
function TEST (line 44) | TEST(MessageTest, DefaultConstructor) {
function TEST (line 50) | TEST(MessageTest, CopyConstructor) {
function TEST (line 57) | TEST(MessageTest, ConstructsFromCString) {
function TEST (line 63) | TEST(MessageTest, StreamsFloat) {
function TEST (line 71) | TEST(MessageTest, StreamsDouble) {
function TEST (line 80) | TEST(MessageTest, StreamsPointer) {
function TEST (line 87) | TEST(MessageTest, StreamsNullPointer) {
function TEST (line 93) | TEST(MessageTest, StreamsCString) {
function TEST (line 98) | TEST(MessageTest, StreamsNullCString) {
function TEST (line 104) | TEST(MessageTest, StreamsString) {
function TEST (line 110) | TEST(MessageTest, StreamsStringWithEmbeddedNUL) {
function TEST (line 120) | TEST(MessageTest, StreamsNULChar) {
function TEST (line 125) | TEST(MessageTest, StreamsInt) {
function TEST (line 131) | TEST(MessageTest, StreamsBasicIoManip) {
function TEST (line 139) | TEST(MessageTest, GetString) {
function TEST (line 146) | TEST(MessageTest, StreamsToOStream) {
function TEST (line 154) | TEST(MessageTest, DoesNotTakeUpMuchStackSpace) {
FILE: test/googletest/test/googletest-options-test.cc
type testing (line 49) | namespace testing {
type internal (line 50) | namespace internal {
function FilePath (line 54) | FilePath GetAbsolutePathOf(const FilePath& relative_path) {
function TEST (line 60) | TEST(XmlOutputTest, GetOutputFormatDefault) {
function TEST (line 65) | TEST(XmlOutputTest, GetOutputFormat) {
function TEST (line 70) | TEST(XmlOutputTest, GetOutputFileDefault) {
function TEST (line 76) | TEST(XmlOutputTest, GetOutputFileSingleFile) {
function TEST (line 82) | TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
function TEST (line 97) | TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
class XmlOutputChangeDirTest (line 126) | class XmlOutputChangeDirTest : public Test {
method SetUp (line 128) | void SetUp() override {
method TearDown (line 136) | void TearDown() override {
function TEST_F (line 143) | TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefault) {
function TEST_F (line 150) | TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefault...
function TEST_F (line 157) | TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativ...
function TEST_F (line 164) | TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativ...
function TEST_F (line 180) | TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolut...
function TEST_F (line 192) | TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolut...
FILE: test/googletest/test/googletest-output-test.py
function ToUnixLineEnding (line 84) | def ToUnixLineEnding(s):
function RemoveLocations (line 90) | def RemoveLocations(test_output):
function RemoveStackTraceDetails (line 107) | def RemoveStackTraceDetails(output):
function RemoveStackTraces (line 115) | def RemoveStackTraces(output):
function RemoveTime (line 122) | def RemoveTime(output):
function RemoveTypeInfoDetails (line 128) | def RemoveTypeInfoDetails(test_output):
function NormalizeToCurrentPlatform (line 142) | def NormalizeToCurrentPlatform(test_output):
function RemoveTestCounts (line 156) | def RemoveTestCounts(output):
function RemoveMatchingTests (line 170) | def RemoveMatchingTests(test_output, pattern):
function NormalizeOutput (line 193) | def NormalizeOutput(output):
function GetShellCommandOutput (line 203) | def GetShellCommandOutput(env_cmd):
function GetCommandOutput (line 224) | def GetCommandOutput(env_cmd):
function GetOutputOfAllCommands (line 241) | def GetOutputOfAllCommands():
class GTestOutputTest (line 261) | class GTestOutputTest(gtest_test_utils.TestCase):
method RemoveUnsupportedTests (line 262) | def RemoveUnsupportedTests(self, test_output):
method testOutput (line 281) | def testOutput(self):
FILE: test/googletest/test/googletest-output-test_.cc
function TestEq1 (line 59) | void TestEq1(int x) {
function TryTestSubroutine (line 65) | void TryTestSubroutine() {
function TEST (line 79) | TEST(PassingTest, PassingTest1) {
function TEST (line 82) | TEST(PassingTest, PassingTest2) {
class FailingParamTest (line 87) | class FailingParamTest : public testing::TestWithParam<int> {}
function TEST_P (line 89) | TEST_P(FailingParamTest, Fails) {
function TEST (line 101) | TEST(NonfatalFailureTest, EscapesStringOperands) {
function TEST (line 109) | TEST(NonfatalFailureTest, DiffForLongStrings) {
function TEST (line 115) | TEST(FatalFailureTest, FatalFailureInSubroutine) {
function TEST (line 122) | TEST(FatalFailureTest, FatalFailureInNestedSubroutine) {
function TEST (line 139) | TEST(FatalFailureTest, NonfatalFailureInSubroutine) {
function TEST (line 146) | TEST(LoggingTest, InterleavingLoggingAndAssertions) {
function SubWithoutTrace (line 161) | void SubWithoutTrace(int n) {
function SubWithTrace (line 167) | void SubWithTrace(int n) {
function TEST (line 173) | TEST(SCOPED_TRACETest, AcceptedValues) {
function TEST (line 184) | TEST(SCOPED_TRACETest, ObeysScopes) {
function TEST (line 203) | TEST(SCOPED_TRACETest, WorksInLoop) {
function TEST (line 214) | TEST(SCOPED_TRACETest, WorksInSubroutine) {
function TEST (line 222) | TEST(SCOPED_TRACETest, CanBeNested) {
function TEST (line 231) | TEST(SCOPED_TRACETest, CanBeRepeated) {
type CheckPoints (line 283) | struct CheckPoints {
function ThreadWithScopedTrace (line 289) | static void ThreadWithScopedTrace(CheckPoints* check_points) {
function TEST (line 305) | TEST(SCOPED_TRACETest, WorksConcurrently) {
function TEST (line 331) | TEST(ScopedTraceTest, WithExplicitFileAndLine) {
function TEST (line 336) | TEST(DisabledTestsWarningTest,
function AdHocTest (line 347) | void AdHocTest() {
function RunAllTests (line 354) | int RunAllTests() {
class NonFatalFailureInFixtureConstructorTest (line 360) | class NonFatalFailureInFixtureConstructorTest : public testing::Test {
method NonFatalFailureInFixtureConstructorTest (line 362) | NonFatalFailureInFixtureConstructorTest() {
method SetUp (line 371) | void SetUp() override { ADD_FAILURE() << "Expected failure #2, in SetU...
method TearDown (line 373) | void TearDown() override {
function TEST_F (line 378) | TEST_F(NonFatalFailureInFixtureConstructorTest, FailureInConstructor) {
class FatalFailureInFixtureConstructorTest (line 383) | class FatalFailureInFixtureConstructorTest : public testing::Test {
method FatalFailureInFixtureConstructorTest (line 385) | FatalFailureInFixtureConstructorTest() {
method SetUp (line 394) | void SetUp() override {
method TearDown (line 400) | void TearDown() override {
method Init (line 407) | void Init() {
function TEST_F (line 412) | TEST_F(FatalFailureInFixtureConstructorTest, FailureInConstructor) {
class NonFatalFailureInSetUpTest (line 419) | class NonFatalFailureInSetUpTest : public testing::Test {
method SetUp (line 423) | void SetUp() override {
method TearDown (line 428) | void TearDown() override { FAIL() << "Expected failure #3, in TearDown...
method Deinit (line 431) | void Deinit() {
function TEST_F (line 436) | TEST_F(NonFatalFailureInSetUpTest, FailureInSetUp) {
class FatalFailureInSetUpTest (line 441) | class FatalFailureInSetUpTest : public testing::Test {
method SetUp (line 445) | void SetUp() override {
method TearDown (line 450) | void TearDown() override { FAIL() << "Expected failure #2, in TearDown...
method Deinit (line 453) | void Deinit() {
function TEST_F (line 458) | TEST_F(FatalFailureInSetUpTest, FailureInSetUp) {
function TEST (line 463) | TEST(AddFailureAtTest, MessageContainsSpecifiedFileAndLineNumber) {
function TEST (line 467) | TEST(GtestFailAtTest, MessageContainsSpecifiedFileAndLineNumber) {
function DieIf (line 474) | void DieIf(bool should_die) {
type SpawnThreadNotifications (line 481) | struct SpawnThreadNotifications {
method SpawnThreadNotifications (line 482) | SpawnThreadNotifications() {}
function ThreadRoutine (line 493) | static void ThreadRoutine(SpawnThreadNotifications* notifications) {
class DeathTestAndMultiThreadsTest (line 504) | class DeathTestAndMultiThreadsTest : public testing::Test {
method SetUp (line 507) | void SetUp() override {
method TearDown (line 517) | void TearDown() override {
type foo (line 538) | namespace foo {
class MixedUpTestSuiteTest (line 540) | class MixedUpTestSuiteTest : public testing::Test {
function TEST_F (line 543) | TEST_F(MixedUpTestSuiteTest, FirstTestFromNamespaceFoo) {}
function TEST_F (line 544) | TEST_F(MixedUpTestSuiteTest, SecondTestFromNamespaceFoo) {}
class MixedUpTestSuiteWithSameTestNameTest (line 546) | class MixedUpTestSuiteWithSameTestNameTest : public testing::Test {
function TEST_F (line 549) | TEST_F(MixedUpTestSuiteWithSameTestNameTest,
type bar (line 554) | namespace bar {
class MixedUpTestSuiteTest (line 556) | class MixedUpTestSuiteTest : public testing::Test {
function TEST_F (line 561) | TEST_F(MixedUpTestSuiteTest, ThisShouldFail) {}
function TEST_F (line 562) | TEST_F(MixedUpTestSuiteTest, ThisShouldFailToo) {}
class MixedUpTestSuiteWithSameTestNameTest (line 564) | class MixedUpTestSuiteWithSameTestNameTest : public testing::Test {
function TEST_F (line 569) | TEST_F(MixedUpTestSuiteWithSameTestNameTest,
class TEST_F_before_TEST_in_same_test_case (line 579) | class TEST_F_before_TEST_in_same_test_case : public testing::Test {
function TEST_F (line 582) | TEST_F(TEST_F_before_TEST_in_same_test_case, DefinedUsingTEST_F) {}
function TEST (line 586) | TEST(TEST_F_before_TEST_in_same_test_case, DefinedUsingTESTAndShouldFail...
class TEST_before_TEST_F_in_same_test_case (line 588) | class TEST_before_TEST_F_in_same_test_case : public testing::Test {
function TEST (line 591) | TEST(TEST_before_TEST_F_in_same_test_case, DefinedUsingTEST) {}
function TEST_F (line 595) | TEST_F(TEST_before_TEST_F_in_same_test_case, DefinedUsingTEST_FAndShould...
function TEST (line 602) | TEST(ExpectNonfatalFailureTest, CanReferenceGlobalVariables) {
function TEST (line 611) | TEST(ExpectNonfatalFailureTest, CanReferenceLocalVariables) {
function TEST (line 622) | TEST(ExpectNonfatalFailureTest, SucceedsWhenThereIsOneNonfatalFailure) {
function TEST (line 630) | TEST(ExpectNonfatalFailureTest, FailsWhenThereIsNoNonfatalFailure) {
function TEST (line 638) | TEST(ExpectNonfatalFailureTest, FailsWhenThereAreTwoNonfatalFailures) {
function TEST (line 648) | TEST(ExpectNonfatalFailureTest, FailsWhenThereIsOneFatalFailure) {
function TEST (line 657) | TEST(ExpectNonfatalFailureTest, FailsWhenStatementReturns) {
function TEST (line 668) | TEST(ExpectNonfatalFailureTest, FailsWhenStatementThrows) {
function TEST (line 681) | TEST(ExpectFatalFailureTest, CanReferenceGlobalVariables) {
function TEST (line 690) | TEST(ExpectFatalFailureTest, CanReferenceLocalStaticVariables) {
function TEST (line 700) | TEST(ExpectFatalFailureTest, SucceedsWhenThereIsOneFatalFailure) {
function TEST (line 708) | TEST(ExpectFatalFailureTest, FailsWhenThereIsNoFatalFailure) {
function FatalFailure (line 715) | void FatalFailure() {
function TEST (line 721) | TEST(ExpectFatalFailureTest, FailsWhenThereAreTwoFatalFailures) {
function TEST (line 731) | TEST(ExpectFatalFailureTest, FailsWhenThereIsOneNonfatalFailure) {
function TEST (line 740) | TEST(ExpectFatalFailureTest, FailsWhenStatementReturns) {
function TEST (line 751) | TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
function ParamNameFunc (line 765) | std::string ParamNameFunc(const testing::TestParamInfo<std::string>& inf...
class ParamTest (line 769) | class ParamTest : public testing::TestWithParam<std::string> {
function TEST_P (line 772) | TEST_P(ParamTest, Success) {
function TEST_P (line 776) | TEST_P(ParamTest, Failure) {
class TypedTest (line 789) | class TypedTest : public testing::Test {
function TYPED_TEST (line 794) | TYPED_TEST(TypedTest, Success) {
function TYPED_TEST (line 798) | TYPED_TEST(TypedTest, Failure) {
class TypedTestWithNames (line 805) | class TypedTestWithNames : public testing::Test {}
class TypedTestNames (line 807) | class TypedTestNames {
method GetName (line 810) | static std::string GetName(int i) {
function TYPED_TEST (line 820) | TYPED_TEST(TypedTestWithNames, Success) {}
function TYPED_TEST (line 822) | TYPED_TEST(TypedTestWithNames, Failure) { FAIL(); }
class TypedTestP (line 830) | class TypedTestP : public testing::Test {
function TYPED_TEST_P (line 835) | TYPED_TEST_P(TypedTestP, Success) {
function TYPED_TEST_P (line 839) | TYPED_TEST_P(TypedTestP, Failure) {
class TypedTestPNames (line 848) | class TypedTestPNames {
method GetName (line 851) | static std::string GetName(int i) {
function TEST (line 871) | TEST(ADeathTest, ShouldRunFirst) {
class ATypedDeathTest (line 880) | class ATypedDeathTest : public testing::Test {
function TYPED_TEST (line 886) | TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
class ATypeParamDeathTest (line 898) | class ATypeParamDeathTest : public testing::Test {
function TYPED_TEST_P (line 903) | TYPED_TEST_P(ATypeParamDeathTest, ShouldRunFirst) {
class ExpectFailureTest (line 916) | class ExpectFailureTest : public testing::Test {
type FailureMode (line 918) | enum FailureMode {
method AddFailure (line 922) | static void AddFailure(FailureMode failure) {
function TEST_F (line 931) | TEST_F(ExpectFailureTest, ExpectFatalFailure) {
function TEST_F (line 945) | TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
class ExpectFailureWithThreadsTest (line 960) | class ExpectFailureWithThreadsTest : public ExpectFailureTest {
method AddFailureInOtherThread (line 962) | static void AddFailureInOtherThread(FailureMode failure) {
function TEST_F (line 968) | TEST_F(ExpectFailureWithThreadsTest, ExpectFatalFailure) {
function TEST_F (line 975) | TEST_F(ExpectFailureWithThreadsTest, ExpectNonFatalFailure) {
function TEST_F (line 986) | TEST_F(ScopedFakeTestPartResultReporterTest, InterceptOnlyCurrentThread) {
function TEST_F (line 1002) | TEST_F(ExpectFailureTest, ExpectFatalFailureOnAllThreads) {
function TEST_F (line 1016) | TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {
class DynamicFixture (line 1031) | class DynamicFixture : public testing::Test {
method DynamicFixture (line 1033) | DynamicFixture() { printf("DynamicFixture()\n"); }
method SetUp (line 1035) | void SetUp() override { printf("DynamicFixture::SetUp\n"); }
method TearDown (line 1036) | void TearDown() override { printf("DynamicFixture::TearDown\n"); }
method SetUpTestSuite (line 1038) | static void SetUpTestSuite() { printf("DynamicFixture::SetUpTestSuite\...
method TearDownTestSuite (line 1039) | static void TearDownTestSuite() {
class DynamicTest (line 1045) | class DynamicTest : public DynamicFixture {
method TestBody (line 1047) | void TestBody() override { EXPECT_TRUE(Pass); }
class FooEnvironment (line 1084) | class FooEnvironment : public testing::Environment {
method SetUp (line 1086) | void SetUp() override { printf("%s", "FooEnvironment::SetUp() called.\...
method TearDown (line 1088) | void TearDown() override {
class BarEnvironment (line 1094) | class BarEnvironment : public testing::Environment {
method SetUp (line 1096) | void SetUp() override { printf("%s", "BarEnvironment::SetUp() called.\...
method TearDown (line 1098) | void TearDown() override {
function main (line 1109) | int main(int argc, char **argv) {
FILE: test/googletest/test/googletest-param-test-invalid-name1-test.py
function Assert (line 39) | def Assert(condition):
function TestExitCodeAndOutput (line 44) | def TestExitCodeAndOutput(command):
class GTestParamTestInvalidName1Test (line 56) | class GTestParamTestInvalidName1Test(gtest_test_utils.TestCase):
method testExitCodeAndOutput (line 58) | def testExitCodeAndOutput(self):
FILE: test/googletest/test/googletest-param-test-invalid-name1-test_.cc
class DummyTest (line 34) | class DummyTest : public ::testing::TestWithParam<const char *> {}
function TEST_P (line 36) | TEST_P(DummyTest, Dummy) {
function main (line 46) | int main(int argc, char *argv[]) {
FILE: test/googletest/test/googletest-param-test-invalid-name2-test.py
function Assert (line 39) | def Assert(condition):
function TestExitCodeAndOutput (line 44) | def TestExitCodeAndOutput(command):
class GTestParamTestInvalidName2Test (line 56) | class GTestParamTestInvalidName2Test(gtest_test_utils.TestCase):
method testExitCodeAndOutput (line 58) | def testExitCodeAndOutput(self):
FILE: test/googletest/test/googletest-param-test-invalid-name2-test_.cc
class DummyTest (line 34) | class DummyTest : public ::testing::TestWithParam<const char *> {}
function StringParamTestSuffix (line 36) | std::string StringParamTestSuffix(
function TEST_P (line 41) | TEST_P(DummyTest, Dummy) {
function main (line 50) | int main(int argc, char *argv[]) {
FILE: test/googletest/test/googletest-param-test-test.cc
function PrintValue (line 70) | ::std::string PrintValue(const T& value) {
function VerifyGenerator (line 78) | void VerifyGenerator(const ParamGenerator<T>& generator,
function VerifyGeneratorIsEmpty (line 120) | void VerifyGeneratorIsEmpty(const ParamGenerator<T>& generator) {
function TEST (line 137) | TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {
function TEST (line 172) | TEST(RangeTest, IntRangeWithDefaultStep) {
function TEST (line 180) | TEST(RangeTest, IntRangeSingleValue) {
function TEST (line 188) | TEST(RangeTest, IntRangeEmpty) {
function TEST (line 195) | TEST(RangeTest, IntRangeWithCustomStep) {
function TEST (line 205) | TEST(RangeTest, IntRangeWithCustomStepOverUpperBound) {
class DogAdder (line 213) | class DogAdder {
method DogAdder (line 215) | explicit DogAdder(const char* a_value) : value_(a_value) {}
method DogAdder (line 216) | DogAdder(const DogAdder& other) : value_(other.value_.c_str()) {}
method DogAdder (line 218) | DogAdder operator=(const DogAdder& other) {
method DogAdder (line 223) | DogAdder operator+(const DogAdder& other) const {
function TEST (line 237) | TEST(RangeTest, WorksWithACustomType) {
class IntWrapper (line 251) | class IntWrapper {
method IntWrapper (line 253) | explicit IntWrapper(int a_value) : value_(a_value) {}
method IntWrapper (line 254) | IntWrapper(const IntWrapper& other) : value_(other.value_) {}
method IntWrapper (line 256) | IntWrapper operator=(const IntWrapper& other) {
method IntWrapper (line 261) | IntWrapper operator+(int other) const { return IntWrapper(value_ + oth...
method value (line 265) | int value() const { return value_; }
function TEST (line 271) | TEST(RangeTest, WorksWithACustomTypeWithDifferentIncrementType) {
function TEST (line 286) | TEST(ValuesInTest, ValuesInArray) {
function TEST (line 294) | TEST(ValuesInTest, ValuesInConstArray) {
function TEST (line 302) | TEST(ValuesInTest, ValuesInSingleElementArray) {
function TEST (line 310) | TEST(ValuesInTest, ValuesInVector) {
function TEST (line 323) | TEST(ValuesInTest, ValuesInIteratorRange) {
function TEST (line 337) | TEST(ValuesInTest, ValuesInSingleElementIteratorRange) {
function TEST (line 349) | TEST(ValuesInTest, ValuesInEmptyIteratorRange) {
function TEST (line 358) | TEST(ValuesTest, ValuesWorks) {
function TEST (line 367) | TEST(ValuesTest, ValuesWorksForValuesOfCompatibleTypes) {
function TEST (line 374) | TEST(ValuesTest, ValuesWorksForMaxLengthList) {
function TEST (line 393) | TEST(ValuesTest, ValuesWithSingleParameter) {
function TEST (line 401) | TEST(BoolTest, BoolWorks) {
function TEST (line 409) | TEST(CombineTest, CombineWithTwoParameters) {
function TEST (line 422) | TEST(CombineTest, CombineWithThreeParameters) {
function TEST (line 436) | TEST(CombineTest, CombineWithFirstParameterSingleValue) {
function TEST (line 448) | TEST(CombineTest, CombineWithSecondParameterSingleValue) {
function TEST (line 459) | TEST(CombineTest, CombineWithFirstParameterEmptyRange) {
function TEST (line 467) | TEST(CombineTest, CombineWithSecondParameterEmptyRange) {
function TEST (line 475) | TEST(CombineTest, CombineWithMaxNumberOfParameters) {
class NonDefaultConstructAssignString (line 490) | class NonDefaultConstructAssignString {
method NonDefaultConstructAssignString (line 492) | NonDefaultConstructAssignString(const std::string& s) : str_(s) {}
function TEST (line 505) | TEST(CombineTest, NonDefaultConstructAssign) {
function TEST (line 535) | TEST(ParamGeneratorTest, AssignmentWorks) {
class TestGenerationEnvironment (line 554) | class TestGenerationEnvironment : public ::testing::Environment {
method TestGenerationEnvironment (line 556) | static TestGenerationEnvironment* Instance() {
method FixtureConstructorExecuted (line 561) | void FixtureConstructorExecuted() { fixture_constructor_count_++; }
method SetUpExecuted (line 562) | void SetUpExecuted() { set_up_count_++; }
method TearDownExecuted (line 563) | void TearDownExecuted() { tear_down_count_++; }
method TestBodyExecuted (line 564) | void TestBodyExecuted() { test_body_count_++; }
method TearDown (line 566) | void TearDown() override {
method TestGenerationEnvironment (line 597) | TestGenerationEnvironment() : fixture_constructor_count_(0), set_up_co...
class TestGenerationTest (line 610) | class TestGenerationTest : public TestWithParam<int> {
method TestGenerationTest (line 619) | TestGenerationTest() {
method SetUp (line 623) | void SetUp() override {
method TearDown (line 627) | void TearDown() override {
method SetUpTestSuite (line 632) | static void SetUpTestSuite() {
method TearDownTestSuite (line 653) | static void TearDownTestSuite() {
function TEST_P (line 674) | TEST_P(TestGenerationTest, TestsExpandedAndRun) {
class GeneratorEvaluationTest (line 692) | class GeneratorEvaluationTest : public TestWithParam<int> {
method param_value (line 694) | static int param_value() { return param_value_; }
method set_param_value (line 695) | static void set_param_value(int param_value) { param_value_ = param_va...
function TEST_P (line 702) | TEST_P(GeneratorEvaluationTest, GeneratorsEvaluatedInMain) {
class ExternalGeneratorTest (line 711) | class ExternalGeneratorTest : public TestWithParam<int> {}
function TEST_P (line 712) | TEST_P(ExternalGeneratorTest, ExternalGenerator) {
function TEST_P (line 724) | TEST_P(ExternalInstantiationTest, IsMultipleOf33) {
class MultipleInstantiationTest (line 730) | class MultipleInstantiationTest : public TestWithParam<int> {}
function TEST_P (line 731) | TEST_P(MultipleInstantiationTest, AllowsMultipleInstances) {
function TEST_P (line 741) | TEST_P(InstantiationInMultipleTranslationUnitsTest, IsMultipleOf42) {
class SeparateInstanceTest (line 749) | class SeparateInstanceTest : public TestWithParam<int> {
method SeparateInstanceTest (line 751) | SeparateInstanceTest() : count_(0) {}
method TearDownTestSuite (line 753) | static void TearDownTestSuite() {
function TEST_P (line 767) | TEST_P(SeparateInstanceTest, TestsRunInSeparateInstances) {
class NamingTest (line 778) | class NamingTest : public TestWithParam<int> {}
function TEST_P (line 780) | TEST_P(NamingTest, TestsReportCorrectNamesAndParameters) {
class MacroNamingTest (line 796) | class MacroNamingTest : public TestWithParam<int> {}
function TEST_P (line 801) | TEST_P(PREFIX_WITH_MACRO(NamingTest), PREFIX_WITH_FOO(SomeTestName)) {
class MacroNamingTestNonParametrized (line 812) | class MacroNamingTestNonParametrized : public ::testing::Test {}
function TEST_F (line 814) | TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized),
function TEST (line 823) | TEST(MacroNameing, LookupNames) {
class CustomFunctorNamingTest (line 857) | class CustomFunctorNamingTest : public TestWithParam<std::string> {}
function TEST_P (line 858) | TEST_P(CustomFunctorNamingTest, CustomTestNames) {}
type CustomParamNameFunctor (line 860) | struct CustomParamNameFunctor {
function CustomParamNameFunction (line 875) | inline std::string CustomParamNameFunction(
class CustomFunctionNamingTest (line 880) | class CustomFunctionNamingTest : public TestWithParam<std::string> {}
function TEST_P (line 881) | TEST_P(CustomFunctionNamingTest, CustomTestNames) {}
class CustomLambdaNamingTest (line 893) | class CustomLambdaNamingTest : public TestWithParam<std::string> {}
function TEST_P (line 894) | TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
function TEST (line 902) | TEST(CustomNamingTest, CheckNameRegistry) {
class CustomIntegerNamingTest (line 922) | class CustomIntegerNamingTest : public TestWithParam<int> {}
function TEST_P (line 924) | TEST_P(CustomIntegerNamingTest, TestsReportCorrectNames) {
type CustomStruct (line 937) | struct CustomStruct {
method CustomStruct (line 938) | explicit CustomStruct(int value) : x(value) {}
class CustomStructNamingTest (line 947) | class CustomStructNamingTest : public TestWithParam<CustomStruct> {}
function TEST_P (line 949) | TEST_P(CustomStructNamingTest, TestsReportCorrectNames) {
type StatefulNamingFunctor (line 963) | struct StatefulNamingFunctor {
method StatefulNamingFunctor (line 964) | StatefulNamingFunctor() : sum(0) {}
class StatefulNamingTest (line 973) | class StatefulNamingTest : public ::testing::TestWithParam<int> {
method StatefulNamingTest (line 975) | StatefulNamingTest() : sum_(0) {}
function TEST_P (line 979) | TEST_P(StatefulNamingTest, TestsReportCorrectNames) {
class Unstreamable (line 995) | class Unstreamable {
method Unstreamable (line 997) | explicit Unstreamable(int value) : value_(value) {}
class CommentTest (line 1005) | class CommentTest : public TestWithParam<Unstreamable> {}
function TEST_P (line 1007) | TEST_P(CommentTest, TestsCorrectlyReportUnstreamableParams) {
class NonParameterizedBaseTest (line 1021) | class NonParameterizedBaseTest : public ::testing::Test {
method NonParameterizedBaseTest (line 1023) | NonParameterizedBaseTest() : n_(17) { }
class ParameterizedDerivedTest (line 1028) | class ParameterizedDerivedTest : public NonParameterizedBaseTest,
method ParameterizedDerivedTest (line 1031) | ParameterizedDerivedTest() : count_(0) { }
function TEST_F (line 1038) | TEST_F(NonParameterizedBaseTest, FixtureIsInitialized) {
function TEST_P (line 1042) | TEST_P(ParameterizedDerivedTest, SeesSequence) {
class ParameterizedDeathTest (line 1048) | class ParameterizedDeathTest : public ::testing::TestWithParam<int> { }
function TEST_F (line 1050) | TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
type MyEnums (line 1059) | enum MyEnums {
class MyEnumTest (line 1065) | class MyEnumTest : public testing::TestWithParam<MyEnums> {}
function TEST_P (line 1067) | TEST_P(MyEnumTest, ChecksParamMoreThanZero) { EXPECT_GE(10, GetParam()); }
function main (line 1071) | int main(int argc, char **argv) {
FILE: test/googletest/test/googletest-param-test-test.h
function class (line 42) | class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
function class (line 47) | class InstantiationInMultipleTranslationUnitsTest
FILE: test/googletest/test/googletest-port-test.cc
type testing (line 51) | namespace testing {
type internal (line 52) | namespace internal {
function TEST (line 54) | TEST(IsXDigitTest, WorksForNarrowAscii) {
function TEST (line 67) | TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) {
function TEST (line 72) | TEST(IsXDigitTest, WorksForWideAscii) {
function TEST (line 85) | TEST(IsXDigitTest, ReturnsFalseForWideNonAscii) {
class Base (line 91) | class Base {
method Base (line 95) | Base() : member_(0) {}
method Base (line 96) | explicit Base(int n) : member_(n) {}
method member (line 98) | int member() { return member_; }
class Derived (line 104) | class Derived : public Base {
method Derived (line 106) | explicit Derived(int n) : Base(n) {}
function TEST (line 109) | TEST(ImplicitCastTest, ConvertsPointers) {
function TEST (line 114) | TEST(ImplicitCastTest, CanUseInheritance) {
class Castable (line 120) | class Castable {
method Castable (line 122) | explicit Castable(bool* converted) : converted_(converted) {}
function TEST (line 132) | TEST(ImplicitCastTest, CanUseNonConstCastOperator) {
class ConstCastable (line 139) | class ConstCastable {
method ConstCastable (line 141) | explicit ConstCastable(bool* converted) : converted_(converted) {}
function TEST (line 151) | TEST(ImplicitCastTest, CanUseConstCastOperatorOnConstValues) {
class ConstAndNonConstCastable (line 158) | class ConstAndNonConstCastable {
method ConstAndNonConstCastable (line 160) | ConstAndNonConstCastable(bool* converted, bool* const_converted)
function TEST (line 176) | TEST(ImplicitCastTest, CanSelectBetweenConstAndNonConstCasrAppropria...
class To (line 192) | class To {
method To (line 194) | To(bool* converted) { *converted = true; }
function TEST (line 197) | TEST(ImplicitCastTest, CanUseImplicitConstructor) {
function TEST (line 204) | TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) {
function TEST (line 220) | TEST(GtestCheckSyntaxTest, WorksWithSwitch) {
function TEST (line 234) | TEST(FormatFileLocationTest, FormatsFileLocation) {
function TEST (line 239) | TEST(FormatFileLocationTest, FormatsUnknownFile) {
function TEST (line 245) | TEST(FormatFileLocationTest, FormatsUknownLine) {
function TEST (
Condensed preview — 165 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,427K chars).
[
{
"path": ".github/workflows/ccpp.yml",
"chars": 167,
"preview": "name: C/C++ CI\n\non: [push]\n\njobs:\n build:\n\n runs-on: ubuntu-latest\n \n steps:\n - uses: actions/checkout@v1\n "
},
{
"path": ".gitignore",
"chars": 23,
"preview": "*.o\n*.log\nmytest\nerror\n"
},
{
"path": "CMakeLists.txt",
"chars": 232,
"preview": "\r\nset(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)\r\nset(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/li"
},
{
"path": "README.md",
"chars": 916,
"preview": "inifile2\n========\n\n## 一个轻量级的inifile文件解析库\n\n### 一. 使用介绍\n* 支持解析ini文件\n* 支持修改、保存ini文件\n* 支持设置多个注释符,默认为“#”和';'\n* 支持参数名重复\n* 使用gt"
},
{
"path": "build.sh",
"chars": 423,
"preview": "#!/bin/bash\n\nset -eu\n\nfunction build_clean()\n{\n rm -rf build\n}\n\nfunction build_test()\n{\n mkdir -p build\n cd bui"
},
{
"path": "src/CMakeLists.txt",
"chars": 328,
"preview": "add_library(inifile STATIC inifile.cpp)\r\nadd_library(inifile_share SHARED inifile.cpp)\r\nadd_custom_target(rename_share_s"
},
{
"path": "src/inifile.cpp",
"chars": 21047,
"preview": "/* Copyright (c) 2014-2019 WinnerHust\n * All rights reserved.\n * Redistribution and use in source and binary forms, with"
},
{
"path": "src/inifile.h",
"chars": 7504,
"preview": "/* Copyright (c) 2014-2019 WinnerHust\n * All rights reserved.\n * Redistribution and use in source and binary forms, with"
},
{
"path": "test/CMakeLists.txt",
"chars": 560,
"preview": "enable_testing()\r\n\r\nadd_subdirectory(googletest)\r\n\r\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR}/googletest/include)\r"
},
{
"path": "test/googletest/CMakeLists.txt",
"chars": 12073,
"preview": "########################################################################\n# Note: CMake support is community-based. The m"
},
{
"path": "test/googletest/CONTRIBUTORS",
"chars": 1401,
"preview": "# This file contains a list of people who've made non-trivial\n# contribution to the Google C++ Testing Framework project"
},
{
"path": "test/googletest/LICENSE",
"chars": 1475,
"preview": "Copyright 2008, Google Inc.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmod"
},
{
"path": "test/googletest/README.md",
"chars": 9921,
"preview": "### Generic Build Instructions\n\n#### Setup\n\nTo build Google Test and your tests that use it, you need to tell your build"
},
{
"path": "test/googletest/cmake/Config.cmake.in",
"chars": 284,
"preview": "@PACKAGE_INIT@\ninclude(CMakeFindDependencyMacro)\nif (@GTEST_HAS_PTHREAD@)\n set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PRE"
},
{
"path": "test/googletest/cmake/gtest.pc.in",
"chars": 311,
"preview": "libdir=@CMAKE_INSTALL_FULL_LIBDIR@\nincludedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@\n\nName: gtest\nDescription: GoogleTest (with"
},
{
"path": "test/googletest/cmake/gtest_main.pc.in",
"chars": 334,
"preview": "libdir=@CMAKE_INSTALL_FULL_LIBDIR@\nincludedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@\n\nName: gtest_main\nDescription: GoogleTest "
},
{
"path": "test/googletest/cmake/internal_utils.cmake",
"chars": 15125,
"preview": "# Defines functions and macros useful for building Google Test and\n# Google Mock.\n#\n# Note:\n#\n# - This file will be run "
},
{
"path": "test/googletest/cmake/libgtest.la.in",
"chars": 499,
"preview": "# libgtest.la - a libtool library file\n# Generated by libtool (GNU libtool) 2.4.6\n\n# Please DO NOT delete this file!\n# I"
},
{
"path": "test/googletest/docs/advanced.md",
"chars": 96220,
"preview": "# Advanced googletest Topics\n\n<!-- GOOGLETEST_CM0016 DO NOT DELETE -->\n\n## Introduction\n\nNow that you have read the [goo"
},
{
"path": "test/googletest/docs/faq.md",
"chars": 31484,
"preview": "# Googletest FAQ\n\n<!-- GOOGLETEST_CM0014 DO NOT DELETE -->\n\n## Why should test suite names and test names not contain un"
},
{
"path": "test/googletest/docs/pkgconfig.md",
"chars": 6428,
"preview": "## Using GoogleTest from various build systems\n\nGoogleTest comes with pkg-config files that can be used to determine all"
},
{
"path": "test/googletest/docs/primer.md",
"chars": 24170,
"preview": "# Googletest Primer\n\n## Introduction: Why googletest?\n\n*googletest* helps you write better C++ tests.\n\ngoogletest is a t"
},
{
"path": "test/googletest/docs/samples.md",
"chars": 1129,
"preview": "# Googletest Samples {#samples}\n\nIf you're like us, you'd like to look at\n[googletest samples.](https://github.com/googl"
},
{
"path": "test/googletest/include/gtest/gtest-death-test.h",
"chars": 14367,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/gtest-matchers.h",
"chars": 27042,
"preview": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/gtest-message.h",
"chars": 8030,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/gtest-param-test.h",
"chars": 23072,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/gtest-printers.h",
"chars": 34029,
"preview": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/gtest-spi.h",
"chars": 10097,
"preview": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/gtest-test-part.h",
"chars": 6853,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/gtest-typed-test.h",
"chars": 15959,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/include/gtest/gtest.h",
"chars": 93895,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/gtest_pred_impl.h",
"chars": 14850,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/gtest_prod.h",
"chars": 2519,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/internal/custom/README.md",
"chars": 1682,
"preview": "# Customization Points\n\nThe custom directory is an injection point for custom user configurations.\n\n## Header `gtest.h`\n"
},
{
"path": "test/googletest/include/gtest/internal/custom/gtest-port.h",
"chars": 1858,
"preview": "// Copyright 2015, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/internal/custom/gtest-printers.h",
"chars": 2079,
"preview": "// Copyright 2015, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/internal/custom/gtest.h",
"chars": 1843,
"preview": "// Copyright 2015, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/internal/gtest-death-test-internal.h",
"chars": 13436,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/internal/gtest-filepath.h",
"chars": 9764,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/internal/gtest-internal.h",
"chars": 54876,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/internal/gtest-param-util.h",
"chars": 32972,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/include/gtest/internal/gtest-port-arch.h",
"chars": 4057,
"preview": "// Copyright 2015, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/internal/gtest-port.h",
"chars": 79430,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/internal/gtest-string.h",
"chars": 7070,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/include/gtest/internal/gtest-type-util.h",
"chars": 5999,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/samples/prime_tables.h",
"chars": 4227,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/samples/sample1.cc",
"chars": 2470,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample1.h",
"chars": 1904,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample10_unittest.cc",
"chars": 4985,
"preview": "// Copyright 2009 Google Inc. All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or with"
},
{
"path": "test/googletest/samples/sample1_unittest.cc",
"chars": 5111,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample2.cc",
"chars": 2260,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample2.h",
"chars": 2968,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample2_unittest.cc",
"chars": 3917,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample3-inl.h",
"chars": 5360,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample3_unittest.cc",
"chars": 5360,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample4.cc",
"chars": 2110,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample4.h",
"chars": 2117,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample4_unittest.cc",
"chars": 1995,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample5_unittest.cc",
"chars": 6585,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/samples/sample6_unittest.cc",
"chars": 8982,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/samples/sample7_unittest.cc",
"chars": 4620,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/samples/sample8_unittest.cc",
"chars": 6194,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/samples/sample9_unittest.cc",
"chars": 5925,
"preview": "// Copyright 2009 Google Inc. All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or with"
},
{
"path": "test/googletest/scripts/README.md",
"chars": 227,
"preview": "# Please Note:\n\nFiles in this directory are no longer supported by the maintainers. They\nrepresent mosty historical arti"
},
{
"path": "test/googletest/scripts/common.py",
"chars": 2919,
"preview": "# Copyright 2013 Google Inc. All Rights Reserved.\n#\n# Redistribution and use in source and binary forms, with or without"
},
{
"path": "test/googletest/scripts/fuse_gtest_files.py",
"chars": 8896,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2009, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/scripts/gen_gtest_pred_impl.py",
"chars": 21967,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/scripts/gtest-config.in",
"chars": 10087,
"preview": "#!/bin/sh\n\n# These variables are automatically filled in by the configure script.\nname=\"@PACKAGE_TARNAME@\"\nversion=\"@PAC"
},
{
"path": "test/googletest/scripts/release_docs.py",
"chars": 6132,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2013 Google Inc. All Rights Reserved.\n#\n# Redistribution and use in source and binar"
},
{
"path": "test/googletest/scripts/run_with_path.py",
"chars": 792,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2010 Google Inc. All Rights Reserved.\n\n\"\"\"Runs program specified in the command line"
},
{
"path": "test/googletest/scripts/test/Makefile",
"chars": 1802,
"preview": "# A Makefile for fusing Google Test and building a sample test against it.\n#\n# SYNOPSIS:\n#\n# make [all] - makes every"
},
{
"path": "test/googletest/scripts/upload.py",
"chars": 52037,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2007, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/scripts/upload_gtest.py",
"chars": 2851,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2009, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/src/gtest-all.cc",
"chars": 2160,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/src/gtest-death-test.cc",
"chars": 62191,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/src/gtest-filepath.cc",
"chars": 14299,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/src/gtest-internal-inl.h",
"chars": 47038,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/src/gtest-matchers.cc",
"chars": 3709,
"preview": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/src/gtest-port.cc",
"chars": 46442,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/src/gtest-printers.cc",
"chars": 14711,
"preview": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/src/gtest-test-part.cc",
"chars": 4126,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/src/gtest-typed-test.cc",
"chars": 3923,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/src/gtest.cc",
"chars": 226527,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/src/gtest_main.cc",
"chars": 1968,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/BUILD.bazel",
"chars": 13722,
"preview": "# Copyright 2017 Google Inc.\n# All Rights Reserved.\n#\n#\n# Redistribution and use in source and binary forms, with or wit"
},
{
"path": "test/googletest/test/googletest-break-on-failure-unittest.py",
"chars": 7301,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/googletest-break-on-failure-unittest_.cc",
"chars": 3240,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-catch-exceptions-test.py",
"chars": 9997,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2010 Google Inc. All Rights Reserved.\n#\n# Redistribution and use in source and bina"
},
{
"path": "test/googletest/test/googletest-catch-exceptions-test_.cc",
"chars": 8386,
"preview": "// Copyright 2010, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-color-test.py",
"chars": 4875,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/googletest-color-test_.cc",
"chars": 2505,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-death-test-test.cc",
"chars": 47431,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-death-test_ex_test.cc",
"chars": 3616,
"preview": "// Copyright 2010, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-env-var-test.py",
"chars": 4004,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/googletest-env-var-test_.cc",
"chars": 3476,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-filepath-test.cc",
"chars": 22642,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-filter-unittest.py",
"chars": 21445,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2005 Google Inc. All Rights Reserved.\n#\n# Redistribution and use in source and binar"
},
{
"path": "test/googletest/test/googletest-filter-unittest_.cc",
"chars": 3466,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-json-outfiles-test.py",
"chars": 5663,
"preview": "#!/usr/bin/env python\n# Copyright 2018, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bina"
},
{
"path": "test/googletest/test/googletest-json-output-unittest.py",
"chars": 22653,
"preview": "#!/usr/bin/env python\n# Copyright 2018, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bina"
},
{
"path": "test/googletest/test/googletest-list-tests-unittest.py",
"chars": 6522,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/googletest-list-tests-unittest_.cc",
"chars": 4668,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-listener-test.cc",
"chars": 24482,
"preview": "// Copyright 2009 Google Inc. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or with"
},
{
"path": "test/googletest/test/googletest-message-test.cc",
"chars": 5265,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-options-test.cc",
"chars": 7854,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-output-test-golden-lin.txt",
"chars": 38990,
"preview": "The non-test part of the code is expected to have 2 failures.\n\ngoogletest-output-test_.cc:#: Failure\nValue of: false\n A"
},
{
"path": "test/googletest/test/googletest-output-test.py",
"chars": 12617,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/googletest-output-test_.cc",
"chars": 36898,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-param-test-invalid-name1-test.py",
"chars": 2379,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2015 Google Inc. All rights reserved.\n#\n# Redistribution and use in source and binar"
},
{
"path": "test/googletest/test/googletest-param-test-invalid-name1-test_.cc",
"chars": 2023,
"preview": "// Copyright 2015, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-param-test-invalid-name2-test.py",
"chars": 2334,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2015 Google Inc. All rights reserved.\n#\n# Redistribution and use in source and binar"
},
{
"path": "test/googletest/test/googletest-param-test-invalid-name2-test_.cc",
"chars": 2138,
"preview": "// Copyright 2015, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-param-test-test.cc",
"chars": 39754,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-param-test-test.h",
"chars": 2252,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-param-test2-test.cc",
"chars": 2813,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-port-test.cc",
"chars": 39560,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-printers-test.cc",
"chars": 51504,
"preview": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-shuffle-test.py",
"chars": 12518,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2009 Google Inc. All Rights Reserved.\n#\n# Redistribution and use in source and binar"
},
{
"path": "test/googletest/test/googletest-shuffle-test_.cc",
"chars": 3218,
"preview": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-test-part-test.cc",
"chars": 8112,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/test/googletest-test2_test.cc",
"chars": 2812,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-throw-on-failure-test.py",
"chars": 5637,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2009, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/googletest-throw-on-failure-test_.cc",
"chars": 3069,
"preview": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/googletest-uninitialized-test.py",
"chars": 2474,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/googletest-uninitialized-test_.cc",
"chars": 1878,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest-typed-test2_test.cc",
"chars": 2018,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/test/gtest-typed-test_test.cc",
"chars": 14972,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/test/gtest-typed-test_test.h",
"chars": 2445,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/test/gtest-unittest-api_test.cc",
"chars": 13370,
"preview": "// Copyright 2009 Google Inc. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or wit"
},
{
"path": "test/googletest/test/gtest_all_test.cc",
"chars": 2239,
"preview": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_assert_by_exception_test.cc",
"chars": 3842,
"preview": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_environment_test.cc",
"chars": 6478,
"preview": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_help_test.py",
"chars": 5822,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2009, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/gtest_help_test_.cc",
"chars": 2088,
"preview": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_json_test_utils.py",
"chars": 2411,
"preview": "# Copyright 2018, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or with"
},
{
"path": "test/googletest/test/gtest_list_output_unittest.py",
"chars": 4919,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/gtest_list_output_unittest_.cc",
"chars": 2123,
"preview": "// Copyright 2018, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_main_unittest.cc",
"chars": 1841,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_no_test_unittest.cc",
"chars": 2403,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_pred_impl_unittest.cc",
"chars": 77498,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_premature_exit_test.cc",
"chars": 4283,
"preview": "// Copyright 2013, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_prod_test.cc",
"chars": 2147,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_repeat_test.cc",
"chars": 7418,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_skip_check_output_test.py",
"chars": 2390,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2019 Google LLC. All Rights Reserved.\n#\n# Redistribution and use in source and bina"
},
{
"path": "test/googletest/test/gtest_skip_environment_check_output_test.py",
"chars": 2209,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2019 Google LLC. All Rights Reserved.\n#\n# Redistribution and use in source and bina"
},
{
"path": "test/googletest/test/gtest_skip_in_environment_setup_test.cc",
"chars": 2069,
"preview": "// Copyright 2019, Google LLC.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_skip_test.cc",
"chars": 2005,
"preview": "// Copyright 2008 Google Inc.\n// All Rights Reserved.\n//\n// Redistribution and use in source and binary forms, with or w"
},
{
"path": "test/googletest/test/gtest_sole_header_test.cc",
"chars": 2175,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_stress_test.cc",
"chars": 9318,
"preview": "// Copyright 2007, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_test_macro_stack_footprint_test.cc",
"chars": 3767,
"preview": "// Copyright 2013, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_test_utils.py",
"chars": 10673,
"preview": "# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or with"
},
{
"path": "test/googletest/test/gtest_testbridge_test.py",
"chars": 2475,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2018 Google LLC. All rights reserved.\n#\n# Redistribution and use in source and binar"
},
{
"path": "test/googletest/test/gtest_testbridge_test_.cc",
"chars": 1923,
"preview": "// Copyright 2018, Google LLC.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_throw_on_failure_ex_test.cc",
"chars": 3398,
"preview": "// Copyright 2009, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_unittest.cc",
"chars": 250444,
"preview": "// Copyright 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_xml_outfile1_test_.cc",
"chars": 1955,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_xml_outfile2_test_.cc",
"chars": 1955,
"preview": "// Copyright 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_xml_outfiles_test.py",
"chars": 5349,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2008, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/gtest_xml_output_unittest.py",
"chars": 18787,
"preview": "#!/usr/bin/env python\n#\n# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and bi"
},
{
"path": "test/googletest/test/gtest_xml_output_unittest_.cc",
"chars": 6192,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/gtest_xml_test_utils.py",
"chars": 9244,
"preview": "# Copyright 2006, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or with"
},
{
"path": "test/googletest/test/production.cc",
"chars": 1675,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/googletest/test/production.h",
"chars": 2115,
"preview": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or "
},
{
"path": "test/inifile_test.cpp",
"chars": 7571,
"preview": "#include <iostream>\n#include <string>\n#include <limits.h>\n#include \"gtest/gtest.h\"\n#define private public\n#define prot"
}
]
About this extraction
This page contains the full source code of the Winnerhust/inifile2 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 165 files (2.2 MB), approximately 589.1k tokens, and a symbol index with 2986 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.