Skip to main content

Autograder for C++

Overview

The program expects that there is a directory containing all the files under test in following order -

base_path/
    |---- some_path1/testbenchi.txt
    |---- some_path2/testbencho.txt
    |---- some_path3/root_folder/
                |---- roll1/
                |       |---- file1.cpp
                |       |---- file2.cpp
                |       |---- some_filename_to_match.cpp
                |---- roll2/
                |       |---- file1.cpp
                    ...

In most cases base_path could be kept an empty string.

Roll is the unique identification string of each submitter.

The autograder looks for every folder/roll in the root folder and checks for the first file whose filename contains the keyword filename_to_match, a parameter to the helper function search_cpp_files(root_folder, filename_to_match). If found, the file is tested under the provided input and output cases. Otherwise, absent is marked.

Modes

  • Summary: Only shows the net number of test cases passed
  • Concise: Shows whether the testcase was passed or failed
  • Standard: Shows passed if test case was passed, shows line-by-line comparision of actual and expected outputs if test case was failed
  • Verbose: Shows line-by-line comparision of actual and expected outputs for each test case

User Instructions

❗ Make sure you have g++ compiler installed on your system before running the autograder
  1. Create an *.txt file containing sample inputs and separate the input test cases using a line containing #testcase_input as the beginnig keyword
  2. Create an *.txt file containing expected outputs and separate the test cases using a line containing #testcase_output as the beginning keyword
  3. Execute the following program with proper parameters
from autogradercpp.autograder import AutograderCpp

autograder = AutograderCpp(
        base_path=BASE_PATH, 
        run_mode=RUN_MODE, 
        timeout_sec=WAIT_TIMEOUT_SEC
    )

autograder.grade_root_dir(
        ROOT_FOLDER_PATH, 
        FILENAME_TO_MATCH, 
        TEST_INPUT_FILE_PATH, 
        TEST_OUTPUT_FILE_PATH 
    )

Some Helper Functions

Below are some helper functions whose usability, I believe, can be expanded beyond just this autograder.

  • autograder.py contains grade_root_dir(args*) which runs the assembled process of finding files and grading every single roll.
  • file_handler.py contains read_test_cases(str) which returns the test case inputs and expected outputs into an array readable by autograder. It has to be run separately for input file and output file.
  • autograder.py contains autograde(args*) which can run the testbench on one file at a time
  • diff.py contains find_and_print_differences(actual_text, expected_text) which compares the texts line by line

Metadata

Release files for autogradercpp 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autogradercpp 0.1.4
File Size Uploaded Provenance
autogradercpp-0.1.4.tar.gz 6.6 kB Without provenance Details

Release files / autogradercpp-0.1.4.tar.gz

Download URL autogradercpp-0.1.4.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e719ead2f678b00359fa6638bf4a3cfb48017d204f07c02f466b03bd7a59f13c
BLAKE2b-256 checksum
How to use checksums
aef873d3bf73e7da5ef467fac24e9aaf1b1e90d7185aa3e427fe4621d74257de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.6

Security for autogradercpp 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page