libgrading
A simple library for grading C and C++ assignments.
|
A library for grading C- and C++-based assignments. More...
#include <functional>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
Go to the source code of this file.
Classes | |
class | grading::SharedMemory |
A representation of a shared memory object. More... | |
Namespaces | |
grading | |
Container for all libgrading names. | |
Enumerations | |
enum | grading::TestResult : char { grading::TestResult::Pass, grading::TestResult::Fail, grading::TestResult::Segfault, grading::TestResult::Timeout, grading::TestResult::OtherError } |
The result of running one test within a separate process. More... | |
Functions | |
CheckResult | grading::operator&& (CheckResult &&, CheckResult &&) |
Combine the results of two checks using a product (AND): both must pass. More... | |
CheckResult | grading::operator&& (CheckResult &&, CheckResult &) |
L-value version of above. More... | |
CheckResult | grading::operator|| (CheckResult &&, CheckResult &&) |
Combine the results of two checks using a sum (OR): at least one must pass. More... | |
CheckResult | grading::operator|| (CheckResult &&, CheckResult &) |
L-value version of above. More... | |
CheckResult | grading::Check (bool, std::string description) |
Check an arbitrary condition, failing the test if false. More... | |
CheckResult | grading::CheckInt (int expected, int actual) |
Check that two integers are equal, failing the test if they are not. More... | |
CheckResult | grading::CheckFloat (double exp, double act, double tolerance=0.000001) |
Check that two floating-point numbers are equal within some tolerance. More... | |
CheckResult | grading::CheckString (std::string expected, std::string actual, size_t maxEditDistance=0) |
Check that two strings are (approximately) equal. More... | |
std::ostream & | grading::operator<< (std::ostream &, TestResult) |
Output a human-readable representation of a TestResult. More... | |
std::unique_ptr< SharedMemory > | grading::MapSharedData (size_t size) |
Map data into the address space that can be shared with other processes. More... | |
TestResult | grading::RunTest (std::function< TestResult()> test, std::string name="<unnamed test>", time_t timeout=0, std::ostream &errorStream=std::cerr) |
Run a test closure in a separate process, capturing segmentation faults and other errors that lead to termination. More... | |
template<class T > | |
TestResult | grading::RunTest (std::function< TestResult(T &)> test, T &output, std::string name="<unnamed test>", time_t timeout=0, std::ostream &errorStream=std::cerr) |
Run a test with output but no explicit input. More... | |
template<class Expectation , class Output > | |
TestResult | grading::RunTest (std::function< TestResult(const Expectation &, Output &)> t, const Expectation &expect, Output &output, std::string name="<unnamed test>", time_t timeout=0, std::ostream &errorStream=std::cerr) |
Run a test with input and output. More... | |
A library for grading C- and C++-based assignments.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file libgrading.h.