-
-
Save jccarbonfive/3890507 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "point.h" | |
struct point MakePoint(int x, int y) | |
{ | |
struct point pt; | |
pt.x = x; | |
pt.y = y; | |
return pt; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rake test:all | |
Test 'test_point.c' | |
------------------- | |
Compiling point.c... | |
Linking test_point.out... | |
Running test_point.out... | |
------------------------- | |
OVERALL UNIT TEST SUMMARY | |
------------------------- | |
TESTED: 1 | |
PASSED: 1 | |
FAILED: 0 | |
IGNORED: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rake module:create[display] | |
Generating 'display'... | |
mkdir -p ./test/. | |
mkdir -p ./src/. | |
File ./test/./test_display.c created | |
File ./src/./display.c created | |
File ./src/./display.h created |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "unity.h" | |
#include "point.h" | |
#include "mock_display.h" | |
// previously defined test <code>setUp</code>, <code>tearDown</code> functions | |
void test_DrawPoint_Draws_Both_of_its_Coordinates(void) | |
{ | |
struct point pt = MakePoint(3, 4); | |
Draw_Int_Expect(3); | |
Draw_Int_Expect(4); | |
DrawPoint(pt); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rake test:pattern[point] | |
Test 'test_point.c' | |
------------------- | |
Linking test_point.out... | |
Undefined symbols for architecture x86_64: | |
"_DrawPoint", referenced from: | |
_test_DrawPoint_Draws_Both_of_its_Coordinates in test_point.o | |
(maybe you meant: _test_DrawPoint_Draws_Both_of_its_Coordinates) | |
"_Draw_Int_Expect", referenced from: | |
_test_DrawPoint_Draws_Both_of_its_Coordinates in test_point.o | |
ld: symbol(s) not found for architecture x86_64 | |
collect2: ld returned 1 exit status | |
ERROR: Shell command failed. | |
> Shell executed command: | |
'gcc "build/test/out/test_point_runner.o" "build/test/out/test_point.o" | |
"build/test/out/mock_display.o" "build/test/out/point.o" | |
"build/test/out/unity.o" "build/test/out/cmock.o" -o | |
"build/test/out/test_point.out"' | |
> And exited with status: [1]. | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef point_H | |
#define point_H | |
// previous declarations | |
void DrawPoint(struct point); | |
#endif // point_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "point.h" | |
// previously defined functions | |
void DrawPoint(struct point pt) | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef display_H | |
#define display_H | |
void Draw_Int(int); | |
#endif // display_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rake test:pattern[point] | |
Test 'test_point.c' | |
------------------- | |
Compiling point.c... | |
Linking test_point.out... | |
Running test_point.out... | |
------------------------ | |
FAILED UNIT TEST SUMMARY | |
------------------------ | |
[test_point.c] | |
Test: test_DrawPoint_Draws_Both_of_its_Coordinates | |
At line (20): "Function 'Draw_Int' called less times than expected." | |
------------------------- | |
OVERALL UNIT TEST SUMMARY | |
------------------------- | |
TESTED: 2 | |
PASSED: 1 | |
FAILED: 1 | |
IGNORED: 0 | |
--------------------- | |
BUILD FAILURE SUMMARY | |
--------------------- | |
Unit test failures. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "point.h" | |
#include "display.h" | |
// previously defined functions | |
void DrawPoint(struct point pt) | |
{ | |
Draw_Int(pt.x); | |
Draw_Int(pt.y); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment