Skip to content

NTU BME Computer Programming Course. Create Autograde code for C++ assessments by professor.

License

Notifications You must be signed in to change notification settings

WesleyCh3n/NTUBME-Autograde

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NTU BME Autograde

WesleyCh3n - NTU BME Autograde Bash - 5.0.17 Made with - Docker

This program create the files which Autolab's autograde needed for NTU BME Computer Programming Course. File tree is as follow,

├───autograde-Makefile
├───autograde.tar
│   ├───score.py
│   └───gtest.cpp
├───answers.yml

You can walk through autograde-Makefile to have the overview of whole concept.

score.py is the main code to grade student score.

gtest.cpp is the Google Test code.

Prerequisites

  • curl: get source code template.
  • jq (v1.5): command-line JSON processor.
  • yq (v3.4.0): command-line YAML processor.

Installation

git clone https://github.com/WesleyCh3n/NTUBME-Autograde.git & cd NTUBME-Autograde
sudo make install

Usage - Generate Autograding Code

  1. First, goto the homework folder, ex. ~/Autolab/courses/<course_name>/<hw_name>/.

  2. Create sample answers.yml by typing

    ga
    
  3. In answers.yml, modify parameters to create the tests you want:

    ---
    Autograde:
      Homework: 4c
      AdditionalTar: ["./Document.txt", "./foo.txt"]
      VariableType: [int, float, double]
      Test:
        - input: [1, 0.2, -32]
          answer:
            - L: abs(ans1)
              op: '<='
              R: 11/3
  4. Once you finished editing, type following cmd to generate autograding code

    ga -Y answers.yml
    

Parameters

Parameters Info Format Exmaple
Autograde Top level
Homework HW number number+problem 6c
AdditionalTar Additional files file1, file2 [file1, file2]
VariableType The tatal type of variables in this question. use list to store types [float, double, int]

Google Test field (Test:): using yaml list syntax to store the lists of tests also lists of logical operation each test. Remember not to write unnecessary -, that may loss some of tests.

This is an example of two test with one and two logical operations.

...
  Test:
    - input: []
      answer:
        - L:
          op: ''
          R:
    - input: []
      answer:
        - L:
          op: ''
          R:
        - L:
          op: ''
          R:
Parameters Info Format Exmaple
input The User input for Google Test. use list to store the test input [12, 13]
answer The right answers. For example, answer1 should be 32, answer2 less than 0.02, etc. see L, op, R below
Parameters Info Format Exmaple
L Left side of operator Use ans<num> describe which variable you want to test. Can implement with mathematical operation like: abs(ans1-ans2) sqrt(ans1)
op logical operator Use quote.
  • Binary operator: =, >, <, !=, >=, <=
  • String comparasion: &=(String match), &?(String not match)
'<='
R Right side of operator Value. Fraction with double-type denominator is also acceptable. (11/3.0)-12

If there is no input, leave it blank. if there is no test, just delete Test: field.

Docker

  1. Create template with HW number.
docker run --rm -v "$PWD":/workdir/ wesleych3n/autograde:v1.1 -n {HW number}
  1. generate codes
docker run --rm -v "$PWD":/workdir/ wesleych3n/autograde:v1.1 -Y {filename}.yml
  • You can put following code to shellrc(ex. ~/.bashrc) to use ga normally as cli.
ga() {
    docker run --rm -v "$PWD":/workdir/ wesleych3n/autograde:v1.2 $@
}

Uninstall

sudo make uninstall

About

NTU BME Computer Programming Course. Create Autograde code for C++ assessments by professor.

Topics

Resources

License

Stars

Watchers

Forks

Packages