42Grader
A simple tester for 42 Piscine, written in Javascript and runs on Node.js runtime.
Table of Contents
Install guide
42grader is avaliable in npm, so just rum npm install
:
npm i -g 42grader
with nvm
1. Install node.js (lts versions are recommanded, especially v18)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install --lts
2. Install 42grader via npm
npm i -g 42grader
without sudo
1. Install node.js (lts versions are recommanded, especially v18)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install --lts
~/.local
2. Change npm prefix to WARNING: YOU HAVE TO UNDERSTAND WHAT CHANGING NPM PREFIX MEANS. IF NOT, YOU SHOULD NOT RUN THIS COMMAND.
npm config set prefix '~/.local/'
echo 'export PATH=~/.local/bin/:$PATH' >> ~/.zshrc
zsh
3. Install 42grader via npm
npm i -g 42grader
How-to-use
42grader
command runs 42Grader.
Interactive shell prompt will be displayed. Follow the instructions in prompt.
Folder structure
42Grader
will use ~/.42Grader
folder.
~/.42Grader/
├─ submission/
│ └─ (cloned git files)
└─ test/
└─ tester files
submissions folder must exists if you choose no
to clone git from remote.
The tester file must exist as a yaml format if you choose yes
to run test(s).
tester file
Tester file should be written in yaml format.
- Write a folder name in
directory
field. - Copy and paste the name of file in
Files to turn in
from your pdf to file field. - Also copy in function field exactly same as function prototype in your pdf.
- In
testcase
, you can use standard functions instdio.h
,stdlib.h
,string.h
andunistd.h
. - All answers trim one trailing newline in default. If you want to add newline in answer, just add
\n
or realnewline
.
This is sample tester file:
test:
- directory: ex00
file: ft_putchar.c
function: void ft_putchar(char c);
testcase: |
ft_putchar('a');
ft_putchar('b');
answer: |
ab
- directory: ex01
file: ft_print_alphabet.c
function: void ft_print_alphabet(void);
testcase: |
ft_print_alphabet();
answer: |
abcdefghijklmnopqrstuvwxyz
- directory: ex02
file: ft_print_reverse_alphabet.c
function: void ft_print_reverse_alphabet(void);
testcase: |
ft_print_reverse_alphabet();
answer: |
zyxwvutsrqponmlkjihgfedcba
About
Do not use 42grader v1 in ./grader v1
. It was written in C but it's almost trash;
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.