mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-09-08 19:29:56 +00:00
Added initial make build support into new scripts/ folder.
Moved temp sensor example into examples/temp_sensor. Added basic make example in examples/make_example.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
CC ?= gcc
|
||||
BUILD_DIR ?= ./build
|
||||
SRC_DIR ?= ./src
|
||||
TEST_DIR ?= ./test
|
||||
#UNITY_DIR ?= ../../vendor/cmock/vendor/unity
|
||||
#CMOCK_DIR ?= ../..
|
||||
TEST_BUILD_DIR ?= ${BUILD_DIR}/test
|
||||
TEST_MAKEFILE = ${TEST_BUILD_DIR}/MakefileTestSupport
|
||||
OBJ ?= ${BUILD_DIR}/obj
|
||||
OBJ_DIR = ${OBJ}
|
||||
|
||||
default: all
|
||||
|
||||
all: setup test ${BUILD_DIR}/main run
|
||||
|
||||
setup:
|
||||
mkdir -p ${BUILD_DIR}
|
||||
mkdir -p ${OBJ}
|
||||
ruby ../../scripts/create_makefile.rb
|
||||
|
||||
clean:
|
||||
rm -rf ${BUILD_DIR}
|
||||
|
||||
${BUILD_DIR}/main: ${SRC_DIR}/main.c ${SRC_DIR}/foo.c
|
||||
${CC} $< -o $@
|
||||
|
||||
run:
|
||||
./build/main
|
||||
|
||||
test: setup
|
||||
|
||||
-include ${TEST_MAKEFILE}
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "foo.h"
|
||||
|
||||
void foo_init(void)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
#ifndef _foo_h
|
||||
|
||||
void foo_init(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
#include "foo.h"
|
||||
|
||||
int real_main(int argc, char ** argv)
|
||||
{
|
||||
printf("Hello world!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef TEST
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
return real_main(argc, argv);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#include "unity.h"
|
||||
#include "foo.h"
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_foo_init_should_initialize_multiplier()
|
||||
{
|
||||
foo_init();
|
||||
|
||||
TEST_ASSERT_FALSE(1);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "unity.h"
|
||||
#include "mock_foo.h"
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_main_should_initialize_foo(void)
|
||||
{
|
||||
TEST_IGNORE_MESSAGE("TODO: Implement main!");
|
||||
}
|
||||
Reference in New Issue
Block a user