• Google Test Primer(入门) (二)——基本概念


    Basic Concepts


    基本概念


    When using Google Test, you start by writing assertions, which are statements that check whether a condition is true. An assertion's result can be success, nonfatal failure, or fatal failure. If a fatal failure occurs, it aborts the current function; otherwise the program continues normally.

    当使用Google Test时,从编写测试条件是否为真断言的语句开始。一个断言的结果可以成功,非致命的失败和致命的失败。如果致命的失败发生了,测试将终止当前函数,否则程序将继续运行。

    Tests use assertions to verify the tested code's behavior. If a test crashes or has a failed assertion, then it fails; otherwise it succeeds.

    测试使用断言确保测试代码行为,如果测试crash了或者断言失败,测试将失败,否则测试成功。


    A test case contains one or many tests. You should group your tests into test cases that reflect the structure of the tested code. When multiple tests in a test case need to share common objects and subroutines, you can put them into a test fixture class.

    一个test case(测试案例)包含一个或多个测试。应该组合你的测试到反射出测试代码结构的测试案例中,当一个测试案例中有多个测试需要共享对象和子过程时,应该将它们放置在一个test fixture类中。


    A test program can contain multiple test cases.

    一个测试程序可以包含多个测试案例


    We'll now explain how to write a test program, starting at the individual assertion level and building up to tests and test cases.

    我们将描述如何编写测试程序,开始使用独立的断言条件和构建测试以及测试案例。

  • 相关阅读:
    LG4377 「USACO2018OPEN」Talent Show 分数规划+背包
    LG4111/LOJ2122 「HEOI2015」小Z的房间 矩阵树定理
    LG5104 红包发红包 概率与期望
    LG2375/LOJ2246 「NOI2014」动物园 KMP改造
    LG4824 「USACO2015FEB」(Silver)Censoring KMP+栈
    20191004 「HZOJ NOIP2019 Round #9」20191004模拟
    LG5357 「模板」AC自动机(二次加强版) AC自动机+fail树
    LG3812 「模板」线性基 线性基
    数据结构
    git
  • 原文地址:https://www.cnblogs.com/ubunoon/p/GoogleTestPrimerConcept.html
Copyright © 2020-2023  润新知