Skip to content

Commit

Permalink
Mark all override methods with override
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebentley15 committed Jun 30, 2017
1 parent 41b9736 commit abfe5c4
Show file tree
Hide file tree
Showing 23 changed files with 179 additions and 179 deletions.
14 changes: 7 additions & 7 deletions data/tests/Empty.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "flit.h"
#include <flit.h>

#include <string>

Expand Down Expand Up @@ -29,7 +29,7 @@ class Empty : public flit::TestBase<T> {
* Can be zero. If it is zero, then getDefaultInput should return an empty
* TestInput object which is as simple as "return {};"
*/
virtual size_t getInputsPerRun() { return 1; }
virtual size_t getInputsPerRun() override { return 1; }

/** Specify the default inputs for your test.
*
Expand All @@ -40,7 +40,7 @@ class Empty : public flit::TestBase<T> {
* If your algorithm takes no inputs, then you can simply return an empty
* TestInput object. It is as simple as "return {};".
*/
virtual flit::TestInput<T> getDefaultInput() {
virtual flit::TestInput<T> getDefaultInput() override {
flit::TestInput<T> ti;
ti.vals = { 1.0 };
return ti;
Expand All @@ -65,14 +65,14 @@ class Empty : public flit::TestBase<T> {
* values are valid for now.
*/
virtual long double compare(long double ground_truth,
long double test_results) const {
long double test_results) const override {
// absolute error
return test_results - ground_truth;
}

/** There is no good default implementation comparing two strings */
virtual long double compare(const std::string &ground_truth,
const std::string &test_results) const {
const std::string &test_results) const override {
FLIT_UNUSED(ground_truth);
FLIT_UNUSED(test_results);
return 0.0;
Expand All @@ -91,7 +91,7 @@ class Empty : public flit::TestBase<T> {
* See the documentation above Empty_kernel() for details about what the
* kernel is expected to have.
*/
virtual flit::KernelFunction<T>* getKernel() { return Empty_kernel; }
virtual flit::KernelFunction<T>* getKernel() override { return Empty_kernel; }

/** Call or implement the algorithm here.
*
Expand All @@ -102,7 +102,7 @@ class Empty : public flit::TestBase<T> {
* You are guarenteed that ti will have exactly getInputsPerRun() inputs in
* it. If getInputsPerRun() returns zero, then ti.vals will be empty.
*/
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
return ti.vals[0];
}

Expand Down
8 changes: 4 additions & 4 deletions gensrc/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class {name} : public flit::TestBase<T> {{
{name}(std::string id)
: flit::TestBase<T>(std::move(id)) {{}}
virtual size_t getInputsPerRun() {{ return {input_count}; }}
virtual flit::TestInput<T> getDefaultInput() {{
virtual size_t getInputsPerRun() override {{ return {input_count}; }}
virtual flit::TestInput<T> getDefaultInput() override {{
flit::TestInput<T> ti;
{default_input}
Expand All @@ -49,12 +49,12 @@ class {name} : public flit::TestBase<T> {{
}}
protected:
virtual flit::KernelFunction<T>* getKernel() {{
virtual flit::KernelFunction<T>* getKernel() override {{
return {name}Kernel;
}}
virtual
flit::Variant run_impl(const flit::TestInput<T>& ti) {{
flit::Variant run_impl(const flit::TestInput<T>& ti) override {{
T score = 0.0;
flit::info_stream << id << ": Starting test with parameters" << std::endl;
Expand Down
8 changes: 4 additions & 4 deletions litmus-tests/tests/DistributivityOfMultiplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class DistributivityOfMultiplication : public flit::TestBase<T> {
DistributivityOfMultiplication(std::string id)
: flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 3; }
virtual flit::TestInput<T> getDefaultInput();
virtual size_t getInputsPerRun() override { return 3; }
virtual flit::TestInput<T> getDefaultInput() override;

protected:
virtual flit::KernelFunction<T>* getKernel() {
virtual flit::KernelFunction<T>* getKernel() override {
return DistOfMultKernel;
}

virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
T a = ti.vals[0];
T b = ti.vals[1];
T c = ti.vals[2];
Expand Down
8 changes: 4 additions & 4 deletions litmus-tests/tests/DoHariGSBasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class DoHariGSBasic: public flit::TestBase<T> {
public:
DoHariGSBasic(std::string id) : flit::TestBase<T>(std::move(id)){}

virtual size_t getInputsPerRun() { return 9; }
virtual flit::TestInput<T> getDefaultInput();
virtual size_t getInputsPerRun() override { return 9; }
virtual flit::TestInput<T> getDefaultInput() override;

protected:
virtual flit::KernelFunction<T>* getKernel() { return DoHGSBTestKernel; }
virtual flit::KernelFunction<T>* getKernel() override { return DoHGSBTestKernel; }

virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
using flit::operator<<;

long double score = 0.0;
Expand Down
8 changes: 4 additions & 4 deletions litmus-tests/tests/DoHariGSImproved.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ class DoHariGSImproved: public flit::TestBase<T> {
public:
DoHariGSImproved(std::string id) : flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 9; }
virtual flit::TestInput<T> getDefaultInput();
virtual size_t getInputsPerRun() override { return 9; }
virtual flit::TestInput<T> getDefaultInput() override;

protected:
virtual flit::KernelFunction<T>* getKernel() { return DoHGSITestKernel; }
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::KernelFunction<T>* getKernel() override { return DoHGSITestKernel; }
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
long double score = 0.0;

//matrix = {a, b, c};
Expand Down
8 changes: 4 additions & 4 deletions litmus-tests/tests/DoMatrixMultSanity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class DoMatrixMultSanity: public flit::TestBase<T> {
public:
DoMatrixMultSanity(std::string id) : flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 16; }
virtual size_t getInputsPerRun() override { return 16; }

virtual flit::TestInput<T> getDefaultInput() {
virtual flit::TestInput<T> getDefaultInput() override {
flit::TestInput<T> ti;
ti.highestDim = getInputsPerRun();
ti.min = -6;
Expand All @@ -39,9 +39,9 @@ class DoMatrixMultSanity: public flit::TestBase<T> {
}

protected:
virtual flit::KernelFunction<T>* getKernel() { return DoMatrixMultSanityKernel; }
virtual flit::KernelFunction<T>* getKernel() override { return DoMatrixMultSanityKernel; }

virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
auto dim = ti.vals.size();
flit::Vector<T> b(ti.vals);
auto c = flit::Matrix<T>::Identity(dim) * b;
Expand Down
8 changes: 4 additions & 4 deletions litmus-tests/tests/DoOrthoPerturbTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class DoOrthoPerturbTest : public flit::TestBase<T> {
public:
DoOrthoPerturbTest(std::string id) : flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 16; }
virtual flit::TestInput<T> getDefaultInput() {
virtual size_t getInputsPerRun() override { return 16; }
virtual flit::TestInput<T> getDefaultInput() override {
flit::TestInput<T> ti;
ti.iters = 200;
ti.ulp_inc = 1;
Expand All @@ -73,9 +73,9 @@ class DoOrthoPerturbTest : public flit::TestBase<T> {
}

protected:
virtual flit::KernelFunction<T>* getKernel() { return DoOPTKernel; }
virtual flit::KernelFunction<T>* getKernel() override { return DoOPTKernel; }

virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
using flit::operator<<;

auto iters = ti.iters;
Expand Down
8 changes: 4 additions & 4 deletions litmus-tests/tests/DoSimpleRotate90.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ class DoSimpleRotate90: public flit::TestBase<T> {
public:
DoSimpleRotate90(std::string id):flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 3; }
virtual flit::TestInput<T> getDefaultInput() {
virtual size_t getInputsPerRun() override { return 3; }
virtual flit::TestInput<T> getDefaultInput() override {
flit::TestInput<T> ti;
ti.vals = { 1, 1, 1 };
return ti;
}

protected:
virtual flit::KernelFunction<T>* getKernel() { return DoSR90Kernel; }
virtual flit::KernelFunction<T>* getKernel() override { return DoSR90Kernel; }

virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
flit::Vector<T> A(ti.vals);
flit::Vector<T> expected = {-A[1], A[0], A[2]};
flit::info_stream << "Rotating A: " << A << ", 1/2 PI radians" << std::endl;
Expand Down
8 changes: 4 additions & 4 deletions litmus-tests/tests/DoSkewSymCPRotationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class DoSkewSymCPRotationTest: public flit::TestBase<T> {
DoSkewSymCPRotationTest(std::string id)
: flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 6; }
virtual flit::TestInput<T> getDefaultInput() {
virtual size_t getInputsPerRun() override { return 6; }
virtual flit::TestInput<T> getDefaultInput() override {
flit::TestInput<T> ti;
ti.min = -6;
ti.max = 6;
Expand All @@ -44,9 +44,9 @@ class DoSkewSymCPRotationTest: public flit::TestBase<T> {
}

protected:
virtual flit::KernelFunction<T>* getKernel() { return DoSkewSCPRKernel;}
virtual flit::KernelFunction<T>* getKernel() override { return DoSkewSCPRKernel;}

virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
flit::info_stream << "entered " << id << std::endl;
long double L1Score = 0.0;
flit::Vector<T> A = { ti.vals[0], ti.vals[1], ti.vals[2] };
Expand Down
6 changes: 3 additions & 3 deletions litmus-tests/tests/FMACancel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ class FMACancel : public flit::TestBase<T> {
public:
FMACancel(std::string id) : flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 2; }
virtual size_t getInputsPerRun() override { return 2; }

flit::TestInput<T> getDefaultInput() {
virtual flit::TestInput<T> getDefaultInput() override {
flit::TestInput<T> ti;
ti.vals = { .1, 1.1e5 };
return ti;
}

protected:
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
const T a = ti.vals[0];
const T b = ti.vals[1];
const T c = a;
Expand Down
6 changes: 3 additions & 3 deletions litmus-tests/tests/InliningProblem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class InliningProblem : public flit::TestBase<T> {
public:
InliningProblem(std::string id) : flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 1; }
virtual size_t getInputsPerRun() override { return 1; }

flit::TestInput<T> getDefaultInput() {
virtual flit::TestInput<T> getDefaultInput() override {
flit::TestInput<T> ti;
ti.vals = { .1, 1.1e3, -.1, -1.1e3, 1/3 };
return ti;
Expand All @@ -23,7 +23,7 @@ class InliningProblem : public flit::TestBase<T> {
const T x_again = -nx;
return x_again;
}
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
T a = ti.vals[0];
T also_a = identity(a);

Expand Down
6 changes: 3 additions & 3 deletions litmus-tests/tests/KahanSum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class KahanSum : public flit::TestBase<T> {
public:
KahanSum(std::string id) : flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 10000; }
virtual flit::TestInput<T> getDefaultInput();
virtual size_t getInputsPerRun() override { return 10000; }
virtual flit::TestInput<T> getDefaultInput() override;

protected:
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
Kahan<T> kahan;
Shewchuk<T> chuk;
T naive = 0.0;
Expand Down
6 changes: 3 additions & 3 deletions litmus-tests/tests/Paranoia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ class Paranoia : public flit::TestBase<F> {
public:
Paranoia(std::string id) : flit::TestBase<F>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 0; }
virtual flit::TestInput<F> getDefaultInput() { return {}; }
virtual size_t getInputsPerRun() override { return 0; }
virtual flit::TestInput<F> getDefaultInput() override { return {}; }

protected:
virtual flit::Variant run_impl(const flit::TestInput<F>& ti);
virtual flit::Variant run_impl(const flit::TestInput<F>& ti) override;

void setTimeout(long millis); // starts the timer for checkTimeout()
void checkTimeout(); // throws TimeoutError if timer from setTimeout has expired
Expand Down
6 changes: 3 additions & 3 deletions litmus-tests/tests/ReciprocalMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ class ReciprocalMath : public flit::TestBase<T> {
public:
ReciprocalMath(std::string id) : flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 5; }
virtual size_t getInputsPerRun() override { return 5; }

flit::TestInput<T> getDefaultInput() {
virtual flit::TestInput<T> getDefaultInput() override {
flit::TestInput<T> ti;
ti.vals = { .1, 1.1e3, -.1, -1.1e3, 1/3 };
return ti;
}

protected:
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
T a = ti.vals[0];
T b = ti.vals[1];
T c = ti.vals[2];
Expand Down
8 changes: 4 additions & 4 deletions litmus-tests/tests/RotateAndUnrotate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class RotateAndUnrotate: public flit::TestBase<T> {
public:
RotateAndUnrotate(std::string id) : flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 3; }
virtual flit::TestInput<T> getDefaultInput() {
virtual size_t getInputsPerRun() override { return 3; }
virtual flit::TestInput<T> getDefaultInput() override {
flit::TestInput<T> ti;
ti.min = -6;
ti.max = 6;
Expand All @@ -37,9 +37,9 @@ class RotateAndUnrotate: public flit::TestBase<T> {
}

protected:
virtual flit::KernelFunction<T>* getKernel() { return RaUKern; }
virtual flit::KernelFunction<T>* getKernel() override { return RaUKern; }

virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
auto theta = M_PI;
auto A = flit::Vector<T>(ti.vals);
auto orig = A;
Expand Down
8 changes: 4 additions & 4 deletions litmus-tests/tests/RotateFullCircle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class RotateFullCircle: public flit::TestBase<T> {
public:
RotateFullCircle(std::string id) : flit::TestBase<T>(std::move(id)){}

virtual size_t getInputsPerRun() { return 3; }
virtual flit::TestInput<T> getDefaultInput() {
virtual size_t getInputsPerRun() override { return 3; }
virtual flit::TestInput<T> getDefaultInput() override {
flit::TestInput<T> ti;
ti.min = -6;
ti.max = 6;
Expand All @@ -42,9 +42,9 @@ class RotateFullCircle: public flit::TestBase<T> {
}

protected:
virtual flit::KernelFunction<T>* getKernel() {return RFCKern; }
virtual flit::KernelFunction<T>* getKernel() override {return RFCKern; }

virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
auto n = ti.iters;
flit::Vector<T> A = flit::Vector<T>(ti.vals);
auto orig = A;
Expand Down
6 changes: 3 additions & 3 deletions litmus-tests/tests/ShewchukSum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class ShewchukSum : public flit::TestBase<T> {
public:
ShewchukSum(std::string id) : flit::TestBase<T>(std::move(id)) {}

virtual size_t getInputsPerRun() { return 1000; }
virtual flit::TestInput<T> getDefaultInput();
virtual size_t getInputsPerRun() override { return 1000; }
virtual flit::TestInput<T> getDefaultInput() override;

protected:
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) {
virtual flit::Variant run_impl(const flit::TestInput<T>& ti) override {
Shewchuk<T> chuk;
T naive = 0.0;
for (auto val : ti.vals) {
Expand Down
Loading

0 comments on commit abfe5c4

Please sign in to comment.