WIP use catch2 instead of unity

custom
jacqueline 2 years ago
parent 1958b262ee
commit e219925fac
  1. 1
      common.cmake
  2. 1
      lib/catch2/CMakeLists.txt
  3. 10
      lib/catch2/catch_runner.cpp
  4. 17976
      lib/catch2/include/catch2/catch.hpp
  5. 3
      lib/catch2/include/catch_runner.hpp
  6. 2
      src/drivers/test/CMakeLists.txt
  7. 6
      src/drivers/test/test_example.cpp
  8. 2
      test/main/CMakeLists.txt
  9. 22
      test/main/main.c
  10. 17
      test/main/main.cpp

@ -12,6 +12,7 @@ set(COMPONENTS "")
# External dependencies
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{PROJ_PATH}/lib/result")
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{PROJ_PATH}/lib/lvgl")
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{PROJ_PATH}/lib/catch2")
# Project components
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{PROJ_PATH}/src")

@ -0,0 +1 @@
idf_component_register(SRCS "catch_runner.cpp" INCLUDE_DIRS "include")

@ -0,0 +1,10 @@
#include "catch_runner.hpp"
#define CATCH_CONFIG_RUNNER
#include "catch2/catch.hpp"
void run_catch(void) {
int argc = 1;
char *argv = "catch2";
Catch::Session().run( argc, &argv );
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,3 @@
#pragma once
void run_catch(void);

@ -1 +1 @@
idf_component_register(SRC_DIRS "." INCLUDE_DIRS "." REQUIRES cmock drivers)
idf_component_register(SRC_DIRS "." INCLUDE_DIRS "." REQUIRES catch2 cmock drivers)

@ -1,9 +1,9 @@
#include "unity.h"
#include "catch2/catch.hpp"
TEST_CASE("Example test case", "[cooltag]") {
TEST_ASSERT_EQUAL(0, 0);
REQUIRE ( 1 == 1 );
}
TEST_CASE("test that doesn't run", "[cooltag][ignore]") {
TEST_ASSERT_EQUAL(0, 1);
REQUIRE ( 0 == 1 );
}

@ -1 +1 @@
idf_component_register(SRCS "main.c" INCLUDE_DIRS ".")
idf_component_register(SRCS "main.cpp" INCLUDE_DIRS "." REQUIRE "catch2")

@ -1,22 +0,0 @@
#include <stdio.h>
#include <string.h>
#include "unity.h"
static void print_banner(const char* text);
void app_main(void)
{
print_banner("Running tests without [ignore] tag");
UNITY_BEGIN();
unity_run_tests_by_tag("[ignore]", true);
UNITY_END();
print_banner("Starting interactive test menu");
unity_run_menu();
}
static void print_banner(const char* text)
{
printf("\n#### %s #####\n\n", text);
}

@ -0,0 +1,17 @@
#include <stdio.h>
#include <string.h>
static void print_banner(const char* text);
extern "C" {
void app_main(void)
{
print_banner("Running tests without [ignore] tag");
}
}
static void print_banner(const char* text)
{
printf("\n#### %s #####\n\n", text);
}
Loading…
Cancel
Save