Giter Club home page Giter Club logo

gooooloo_test's Introduction

gooooloo_test

A very simple header file for writing simple unit tests in C++.

Why?

Existing C++ UT tools like GTest are very strong, but not lightweight enough. Sometimes I just write very simple codes and would like to test them. I don't want to install another module, or to use CMake. I just want a simple g++ test.cpp && ./a.out and hope to see everything just works.

Usage

#include "gooooloo_test.h"

GOOOOLOO_TEST(good_case)
{
    GOOOOLOO_ASSERT_EQUAL_INT(42, 42);
    return 0;
}

int main() {
    return 0;
}

GOOD

  • Just #include "gooooloo_test.h" in cpp, then you can write your UTs.
  • Adding a case is very easy, just GOOOOLOO_TEST(your_unique_test_case_name) and write your case. You don't need to call it explicitly anywhere else!

BAD

  • Need to write { in the next line after ther GOOOOLOO_TEST(case_name) line.
  • Need to explict write return 0; in every case.
  • Test case name should not conflict with existing symbles. For example, if you write a function named foo, and would like to test, then you can not to write GOOOOLOO_TEST(foo). You have to modify the case name, such as GOOOOLOO_TEST(test_foo).
  • Very limited assert functions. This can be improved gradually.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.