mdr is a small program and markup designed to facilitate documentation and testing.
I started it to ease Gwion's devellopment, but it is not tied in any way to this project.
Let' walktrough... 😄
let's write our first litterate progam.
hello_world.c
@[[ Includes ]]
int main(int argc, char** argv) {
@[[ Print ]]
}
As we need the puts function, we need stdio headers.
Includes
#include <stdio.h>
puts("Hello, World!");
let's compile hello_world.c.
exec: cc hello_world.c -o hello_world
Yes, there should be no output, and that good news.
Let's look at hello_world.c
exec: cat hello_world.c
#include <stdio.h>
int main(int argc, char** argv) {
puts("Hello, World!");
}
That's the content of the source file we generated (and compiled).
Then we run it
exec: ./hello_world
Hello, World!
Do we read Hello World! ? Assuming yes, let's continue.
exec: [ "$(./hello_world)" = "Hello, World!" ] && echo "OK" || echo "NOT_OK"
OK
As a C program, it seemed natural to use make as a build system.
make
Also using make:
make test
You can also try
bash scripts/test.sh
As easy as before, just type.
make install
or just copy mdr
somewhere in your path.
generated from this file