You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/CONTRIBUTING.md
+22-26Lines changed: 22 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,40 +77,36 @@ clang-format -i $(file)
77
77
78
78
## Exercise anatomy
79
79
80
-
Each exercise should be contained in a directory `c/exercises/{exercise-name}`.
80
+
Each exercise should be contained in a directory `c/exercises/practice/{exercise-name}`.
81
81
See [implement-an-exercise-from-specification][] for in depth details on implementing an exercise that matches the specification
82
82
83
-
The structure of en exercise directory is as follows (note the differing hyphen and underscore usage for directory names and file names respectively):
83
+
The structure of an exercise directory is as follows (note the differing hyphen and underscore usage for directory names and file names respectively):
84
84
85
85
```text
86
86
+-- {exercise-name}
87
87
+-- makefile
88
-
+-- README.md
89
-
+-- src
90
-
| +-- example.c
91
-
| +-- example.h | {exercise_name}.h
92
-
+-- test
93
-
+-- test_{exercise_name}.c
94
-
+-- vendor
95
-
+-- unity.c
96
-
+-- unity.h
97
-
+-- unity_internals.h
88
+
+-- {exercise-name}.c
89
+
+-- {exercise-name}.h
90
+
+-- test_{exercise-name}.c
91
+
+-- test-framework
92
+
| +-- unity.c
93
+
| +-- unity.h
94
+
| +-- unity_internals.h
98
95
```
99
96
100
-
*`test` - contains the test file `test_{exercise_name}.c` and a `vendor` directory containing the test harness [Unity][] from [ThrowTheSwitch][].
101
-
ThrowTheSwitch has a decent guide on [getting started with Unity][] should you desire a tutorial.
102
-
The version of Unity used is indicated in [versions][]. The layout of the test file is described in the [style guide][test-file-layout].
103
-
Tests should be written that satisfy `canonical-data.json` file for the exercise in the [problem-specifications][] repository
104
-
*`src` - contains the example files `example.c` and `example.h`.
105
-
These are both skipped by the `exercism` CLI when downloading to the client, so it is imperative that you do not reference the names of the files in your code.
106
-
If you need to provide a header file example that is necessary to run your tests it should be named `{my_exercise}.h` instead.
107
-
Please also use [include guards][] in your header files.
108
-
The exercise tests can be run using `make` from the repository root.
109
-
The top-level makefile will rename the `example.{c|h}` files accordingly (use `make help` to learn about individual targets).
110
-
*`makefile` - is the makefile for the exercise as it would build using proper filenames (i.e. `{exercise_name}.c` and `{exercise_name}.h` instead of `example.c` and `example.h` respectively).
111
-
Makefiles are expected to change very little between exercises so it should be easy to copy one from another exercise.
112
-
*`README.md` - is the readme that relates to the exercise.
113
-
These can be generated by the [configlet][] tool from `description.md` for the exercise in the [problem-specifications][] repository, or alternatively a custom one can be written.
97
+
`test_{exercise_name}.c` - This file contains all the tests for the exercise.
98
+
`test-framework` - directory containing the test harness [Unity][] from [ThrowTheSwitch][].
99
+
ThrowTheSwitch has a decent guide on [getting started with Unity][] should you desire a tutorial.
100
+
The version of Unity used is indicated in [versions][]. The layout of the test file is described in the [style guide][test-file-layout].
101
+
Tests should be written to satisfy `canonical-data.json` file for the exercise in the [problem-specifications][] repository
102
+
`{exercise-name}.c` / `{exercise-name}.h` - The exercise's source files.
103
+
Please use [include guards][] in your header files.
104
+
The exercise tests can be run using `make test` from the repository root.
105
+
*`makefile` - is the makefile for the exercise as it would build.
106
+
Two rules are required,
107
+
test: compile test_{exercise-name}.c and run it.
108
+
memcheck: compile test_{exercise-name} with -fsanitize=address, -fno-common, -fno-omit-frame-pointer flag and run it
109
+
Makefiles are expected to change very little between exercises so it should be easy to copy one from another exercise.
114
110
115
111
**Don't forget** to add the exercise to the track's `config.json`. For this you will need to determine the best place to add the exercise within the order of all other track exercises. You will also need to generate a UUID to add here. For both of these tasks you can use the [configlet][] tool; the tool will even lint and format the `config.json` for you after you've made these changes!
0 commit comments