Skip to content

Instantly share code, notes, and snippets.

@chrismullins
Last active December 15, 2015 21:49
Show Gist options
  • Save chrismullins/5328158 to your computer and use it in GitHub Desktop.
Save chrismullins/5328158 to your computer and use it in GitHub Desktop.
A CTest example so minimalistic that it is probably not useful to anyone. Enjoy!

CTest Example

After you clone this, run the following commands:

  • $ mkdir build && cd build
  • $ cmake ..
  • $ make and observe that the executable is made.
  • $ make test

Bonus Points

  1. Make a test that actually does something.
cmake_minimum_required(VERSION 2.8)
project(CTest-Example)
add_executable(CTest-Example CTest-Example)
enable_testing()
add_test(NAME YeahhhTest COMMAND ${CMAKE_COMMAND} -E echo 'Yeahh')
#include <iostream>
int main()
{
std::cout << "This is the whole thing." << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment