From e1d85f5ca79482a065c1c1235af3124ee2119d7a Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Fri, 2 Dec 2016 01:44:00 +0330 Subject: added tdd tests --- test/CMakeLists.txt | 2 ++ test/compile_commands.json | 2 +- test/testFuncs1.c | 5 +++-- test/testFuncs1.h | 5 ++--- test/testFuncs2.c | 23 +++++++++++++++++++++++ test/testFuncs2.h | 10 ++++++---- 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9837520..81abaad 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,5 @@ cmake_minimum_required (VERSION 2.6) project (tdd_test) +set(CMAKE_C_COMPILER_ID "Clang") +set(CMAKE_CXX_COMPILER_ID "Clang") add_executable(tddtest main.c testFuncs1.c testFuncs2.c) diff --git a/test/compile_commands.json b/test/compile_commands.json index c66a5ae..6267819 100644 --- a/test/compile_commands.json +++ b/test/compile_commands.json @@ -14,4 +14,4 @@ "directory": "/home/bloodstalker/devi/hell2/test", "file": "/home/bloodstalker/devi/hell2/test/testFuncs2.c" } -] \ No newline at end of file +] diff --git a/test/testFuncs1.c b/test/testFuncs1.c index 20a40f2..e0522e8 100644 --- a/test/testFuncs1.c +++ b/test/testFuncs1.c @@ -4,8 +4,9 @@ /*include*/ /**********************************************************************************************************************/ #include "testFuncs1.h" -//#include - +#if 0 +#include +#endif /**************************************************MACROS & DEFS*******************************************************/ /**********************************************************************************************************************/ #define LUPO 1U diff --git a/test/testFuncs1.h b/test/testFuncs1.h index 3e32906..ec88050 100644 --- a/test/testFuncs1.h +++ b/test/testFuncs1.h @@ -2,8 +2,8 @@ /*the first line's been intentionally left blank.*/ /***********************************************************************************************************/ /*defines*/ -#ifndef TESTFUNCS1_H -#define TESTFUNCS1_H +#ifndef _TEST1_H +#define _TEST1_H #define FALSE 0 #define TRUE 1 @@ -129,7 +129,6 @@ void test27(void); void test28(void); int test29(int a); int test31(void); - #endif /***********************************************************************************************************/ /*ive been intentionally left blank. dont touch me.*/ diff --git a/test/testFuncs2.c b/test/testFuncs2.c index 309c280..fb30dd8 100644 --- a/test/testFuncs2.c +++ b/test/testFuncs2.c @@ -3,9 +3,25 @@ /*********************************************************************************************************************/ /*inclusion directives*/ #include "testFuncs2.h" +#if 0 +#include +#include +#include +#include +#include +#endif /*********************************************************************************************************************/ /*macro and definitions*/ typedef const* INTPTR; + +#define XMACRO Y + +#define ABSOLUTE(X) (((X) >= 0) ? (X) : -(X)) +#define ABSOLUTE2(X) ((X >= 0) ? X : -X) +#define ABSOLUTE3(XMACRO) (((XMACRO) <= 0) ? (XMACRO) : -(XMACRO)) + +#define LOCOLUPO +#undef LOCOLUPO /*********************************************************************************************************************/ /*Globals*/ @@ -13,6 +29,7 @@ typedef const* INTPTR; /*functions go here.*/ static void test33(void) { + short int a; long int b; @@ -27,6 +44,9 @@ void testfunc1(void) b = a; } +#if CRAZYMACRO < 0 +#endif + testfunc2(void) { int a; @@ -42,6 +62,9 @@ void testfunc3() int b; int c; + int abcdefghijklmnopqrstuvwxyz1234567890; + int abcdefghijklmnopqrstuvwxyz12345678902; + /*do stuff*/ } diff --git a/test/testFuncs2.h b/test/testFuncs2.h index 85ddeee..fa4ce13 100644 --- a/test/testFuncs2.h +++ b/test/testFuncs2.h @@ -2,13 +2,13 @@ /*first line intentionally left blank.*/ /*********************************************************************************************************************/ /*Defines*/ -#ifndef TESTFUNCS2_H -#define TESTFUNCS2_H +#ifndef _TEST2_H +#define _TEST2_H /*********************************************************************************************************************/ /*Globals*/ -extern int a[]; +extern int aaaa[]; -extern int b[] = {1, 2, 3, 4, 5, 6}; +extern int bbbb[] = {1, 2, 3, 4, 5, 6}; int c[2][3] = {1, 2, 3, 4, 5, 6}; @@ -17,6 +17,8 @@ int d[2][3] = {{1, 2, 3}, {4, 5, 6}}; /*funciton types go here.*/ static void test33(void); +void testFunc1(void); + void testFunc4() { /*do shit*/ -- cgit v1.2.3