Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

a modern, portable, cross-language unit testing and mocking framework for C and C++

License

LGPL-2.1, LGPL-2.1 licenses found

Licenses found

LGPL-2.1
LICENSE
LGPL-2.1
COPYING
NotificationsYou must be signed in to change notification settings

matthargett/cgreen

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux:Build Status

Coverage Status

Cgreen - The Modern Unit Test and Mocking Framework for C and C++

Do you TDD? In C? Maybe you want to have your tests read out in afluent fashion? Like this

Ensure(Converter, converts_XIV_to_14) {    assert_that(convert_roman_to_decimal("XIV"), is_equal_to(14));}

And you want output like this

roman_test.c:12: Failure: Converter -> converts_XIV_to_14        Expected [convert_roman_to_decimal("XIV")] to [equal] [14]                actual value:                   [0]                expected value:                 [14]

ThenCgreen is the thing for you!

What It Is

Cgreen is a modern unit test and mocking framework for C and C++. Hereare some of Cgreens unique selling points:

  • fast build, clean code, highly portable
  • auto-discovery of tests without the abuse of static initializers or globals
  • extensible without recompiling
  • fluent, expressive and readable API with the same modern syntax across C and C++
  • process isolation for each test preventing intermittent failuresand cross-test dependencies
  • built-in mocking for C, compatible with mockitopp and other C++ mocking libraries

Getting It

Cgreen has recently moved from SourceForge to GitHub so things are ina bit of a flux. FromSourceForgeyou can get pre-build packages for not-so-old development versions.

ButCgreen is approaching a 1.0 release and things are changing, sofor now an alternative is to download the zip fromGitHub and build ityourself.

Building It

You needCmake but most standard C/C++compilers should work. GCC definitely does.

In the root directory runmake. That will configure and build the Cversion and the C++ version of the libraries.

Reading Up!

The documentation is fairly up-to-date. You can read the extensivetutorial directly onGitHub.

You can also build the documentation yourself in HTML and PDF format.Generate it using Asciidoctor, which can be done using the Cmakeconfiguration. Of course you needAsciidoctor.

Navigate to thebuild/build-c directory. You need to add theWITH_HTML and/orWITH_PDF option:

cmake -DWITH_HTML:bool=ON ../..

Runmake. For example

cd build/build-ccmake -DWITH_HTML:bool=ON -DWITH_PDF:bool=ON ../..make

License

If there is no licence agreement with this package please downloada version from the location above. You must read and accept thatlicence to use this software. The file is titled simply LICENSE.

The Original, Longer Version

What is it? It's a framework for unit testing, written in C. A toolfor C developers writing tests of their own code.

If you have used JUnit, or any of the xUnit clones, you will findthe concept familiar. In particular the tool supports a range ofassertions, composable test suites and setup/teardown facilities.Because of the peculiarities of C programming, each test functionis normally run in it's own process.

This project is very close in scope to the "Check" unit tester andwas influenced by it...http://check.sourceforge.net/projects/check/

The main difference from this tool and other xUnit tools, such as"Check", is that test results are not stored. Instead they arestreamed to the reporter psuedo-class, one that is easilyoverridden by the end user.

The other main extra feature is the support for writing mockcallbacks. This includes generating sequences for return valuesor parameter expectations.

Feedback, queries and request should be put to the cgreen developers throughhttps://github.com/cgreen-devs/cgreen.

This tool is basically a spin off from a research project atWordtracker and would not have happened without the generousfinancial support of the Wordtracker keyword tool...http://www.wordtracker.com/

Substantial inital work by Marcus Bakermarcus@lastcraft.com. Recentadditions by Matt Hargettmatt@use.net, Thomas Nilssonthomas@junovagen.se, João Freitasjoaohf@gmail.com and others.

About

a modern, portable, cross-language unit testing and mocking framework for C and C++

Resources

License

LGPL-2.1, LGPL-2.1 licenses found

Licenses found

LGPL-2.1
LICENSE
LGPL-2.1
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C73.8%
  • C++11.9%
  • CMake11.3%
  • Makefile1.1%
  • Perl0.8%
  • Shell0.7%
  • Other0.4%

[8]ページ先頭

©2009-2025 Movatter.jp