-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
* Added Cpp testing structure! * Added Test Fixture Class * Forced the cluster to only return OTU data, and created the fix test fixture with test! * Created all of the test for the optimatrix adapter and removed the .dll from being tracked! * Created all the test in the testfixture for listvectors and now I am adding them to the test files. * Created base test for listVector * Basic test for listVector are completed! * Created the basic structure and test fixture for cluster commands * Cluster Testing suite being pushed up! * Fix cluster algorithm (#2) * Fixed a slew of issues by adding bidirection distances. * Fixed the clustering issue, clustering should be working correctly now! * Generated Definitions for OptiCluster Test * Finished creating unit test of the cluster command and opticluster * Added OptiData test fixture * Started creating the unit test for utils * Utils command cluster and test work as expected!! * Removed old code from one of the testing suites. * Added another test in utils. * Clustor has a 89% test coverage! Everything should be tested and ready to merge back!
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Mac", | ||
"includePath": [ | ||
"${workspaceFolder}/**" | ||
], | ||
"defines": [], | ||
"macFrameworkPath": [ | ||
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks" | ||
], | ||
"compilerPath": "/usr/bin/clang", | ||
"cStandard": "c17", | ||
"cppStandard": "c++17", | ||
"intelliSenseMode": "macos-clang-arm64" | ||
} | ||
], | ||
"version": 4 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"files.associations": { | ||
"__bit_reference": "cpp", | ||
"__config": "cpp", | ||
"__hash_table": "cpp", | ||
"__locale": "cpp", | ||
"__node_handle": "cpp", | ||
"__split_buffer": "cpp", | ||
"__threading_support": "cpp", | ||
"__tree": "cpp", | ||
"__verbose_abort": "cpp", | ||
"array": "cpp", | ||
"bitset": "cpp", | ||
"cctype": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"complex": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"execution": "cpp", | ||
"fstream": "cpp", | ||
"initializer_list": "cpp", | ||
"iomanip": "cpp", | ||
"ios": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"list": "cpp", | ||
"locale": "cpp", | ||
"map": "cpp", | ||
"mutex": "cpp", | ||
"new": "cpp", | ||
"optional": "cpp", | ||
"ostream": "cpp", | ||
"ratio": "cpp", | ||
"set": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"string": "cpp", | ||
"string_view": "cpp", | ||
"tuple": "cpp", | ||
"typeinfo": "cpp", | ||
"unordered_map": "cpp", | ||
"unordered_set": "cpp", | ||
"variant": "cpp", | ||
"vector": "cpp", | ||
"algorithm": "cpp" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Generated by using Rcpp::compileAttributes() -> do not edit by hand | ||
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 | ||
|
||
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, rowSize, colSize, iterations = 2L) { | ||
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, rowSize, colSize, iterations) | ||
MatrixToOpiMatrixCluster <- function(xPosition, yPosition, data, cutoff, iterations = 2L) { | ||
Check notice Code scanning / lintr Variable and function name style should match snake_case or symbols. Note
Variable and function name style should match snake_case or symbols.
Check notice Code scanning / lintr Variable and function name style should match snake_case or symbols. Note
Variable and function name style should match snake_case or symbols.
Check notice Code scanning / lintr Variable and function name style should match snake_case or symbols. Note
Variable and function name style should match snake_case or symbols.
Check notice Code scanning / lintr Lines should not be more than 80 characters. This line is 91 characters. Note
Lines should not be more than 80 characters. This line is 91 characters.
|
||
.Call(`_Opticluster_MatrixToOpiMatrixCluster`, xPosition, yPosition, data, cutoff, iterations) | ||
Check notice Code scanning / lintr Indentation should be 2 spaces but is 4 spaces. Note
Indentation should be 2 spaces but is 4 spaces.
Check warning Code scanning / lintr no visible binding for global variable '_Opticluster_MatrixToOpiMatrixCluster' Warning
no visible binding for global variable '_Opticluster_MatrixToOpiMatrixCluster'
Check notice Code scanning / lintr Lines should not be more than 80 characters. This line is 98 characters. Note
Lines should not be more than 80 characters. This line is 98 characters.
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# This dummy function definition is included with the package to ensure that | ||
# 'tools::package_native_routine_registration_skeleton()' generates the required | ||
# registration info for the 'run_testthat_tests' symbol. | ||
(function() { | ||
.Call("run_testthat_tests", FALSE, PACKAGE = "Opticluster") | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// Created by Gregory Johnson on 5/1/24. | ||
// | ||
|
||
#include "tests/ClusterCommandTestFixture.h" | ||
|
||
bool ClusterCommandTestFixture::TestSetIterationsWorksCorrectly(const int iterations, const bool expectResult) { | ||
Setup(); | ||
const bool result = clusterCommand->SetMaxIterations(iterations); | ||
TearDown(); | ||
return result == expectResult; | ||
} | ||
|
||
void ClusterCommandTestFixture::Setup() { | ||
clusterCommand = std::make_unique<ClusterCommand>(); | ||
} | ||
|
||
void ClusterCommandTestFixture::TearDown() { | ||
clusterCommand.reset(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
// | ||
// Created by Gregory Johnson on 5/1/24. | ||
// | ||
|
||
#include "tests/ListVectorTestFixture.h" | ||
|
||
bool ListVectorTestFixture::TestListVectorReturnsCorrectNumberOfBins(const std::vector<std::string>& mockListOfSequences, | ||
const int expectedResult) { | ||
Setup(); | ||
for (const auto& sequences: mockListOfSequences) { | ||
listVector->push_back(sequences); | ||
} | ||
const bool result = listVector->getNumBins() == expectedResult; | ||
TearDown(); | ||
return result; | ||
} | ||
|
||
bool ListVectorTestFixture::TestListVectorReturnsCorrectNumSeqs(const std::vector<std::string> &mockListOfSequences, | ||
const int expectedResult) { | ||
Setup(); | ||
for (const auto& sequences: mockListOfSequences) { | ||
listVector->push_back(sequences); | ||
} | ||
const bool result = listVector->getNumSeqs() == expectedResult; | ||
TearDown(); | ||
return result; | ||
} | ||
|
||
bool ListVectorTestFixture::TestListVectorReturnsCorrectMaxRank(const std::vector<std::string> &mockListOfSequences, | ||
const int expectedResult) { | ||
Setup(); | ||
for (const auto& sequences: mockListOfSequences) { | ||
listVector->push_back(sequences); | ||
} | ||
const bool result = listVector->getMaxRank() == expectedResult; | ||
TearDown(); | ||
return result; | ||
} | ||
|
||
bool ListVectorTestFixture::TestListVectorReturnsCorrectGetValue(const std::vector<std::string> &mockListOfSequences, | ||
const int index, const std::string &expectedResult) { | ||
Setup(); | ||
for (const auto& sequences: mockListOfSequences) { | ||
listVector->push_back(sequences); | ||
} | ||
const bool result = listVector->get(index) == expectedResult; | ||
TearDown(); | ||
return result; | ||
} | ||
|
||
bool ListVectorTestFixture::TestListVectorReturnsCorrectGetLabelsValue( | ||
const std::vector<std::string> &mockListOfSequences, const int expectedResult) { | ||
Setup(); | ||
for (const auto& sequences: mockListOfSequences) { | ||
listVector->push_back(sequences); | ||
} | ||
const bool result = listVector->getLabels().size() == expectedResult; | ||
TearDown(); | ||
return result; | ||
} | ||
|
||
bool ListVectorTestFixture::TestListVectorReturnsCorrectGetOtuNames(const std::vector<std::string> &mockListOfSequences, | ||
const int binToTest, const std::string &expectedResult) { | ||
Setup(); | ||
for (const auto& sequences: mockListOfSequences) { | ||
listVector->push_back(sequences); | ||
} | ||
const bool result = listVector->getOTUName(binToTest) == expectedResult; | ||
TearDown(); | ||
return result; | ||
} | ||
|
||
bool ListVectorTestFixture::TestListVectorSetsLabelsCorrectly(const std::vector<std::string> &mockListOfLabels, | ||
const int expectedResult) { | ||
Setup(); | ||
listVector->setLabels(mockListOfLabels); | ||
const bool result = listVector->getLabels().size() == expectedResult; | ||
TearDown(); | ||
return result; | ||
} | ||
|
||
bool ListVectorTestFixture::TestListVectorSetsPrintedLabelsCorrectly(const bool mockValue, const bool expectedResult) { | ||
Setup(); | ||
const bool result = expectedResult == listVector->setPrintedLabels(mockValue); | ||
TearDown(); | ||
return result; | ||
} | ||
|
||
bool ListVectorTestFixture::TestListVectorPushBackSetsDataCorrectly(const std::vector<std::string>& mockListOfSequences, | ||
const int index, const std::string& expectedResult) { | ||
Setup(); | ||
for (const auto& sequences: mockListOfSequences) { | ||
listVector->push_back(sequences); | ||
} | ||
const bool result =listVector->get(index) == expectedResult; | ||
TearDown(); | ||
return result; | ||
|
||
} | ||
|
||
bool ListVectorTestFixture::TestListVectorPrintDisplaysDataCorrectly( | ||
const std::vector<std::string> &mockListOfSequences, const std::string& expectedResult) { | ||
Setup(); | ||
std::ofstream stream; | ||
for (const auto& sequences: mockListOfSequences) { | ||
listVector->push_back(sequences); | ||
} | ||
// Get rid of ofstream in listVector | ||
const bool result =listVector->print(stream) == expectedResult; | ||
TearDown(); | ||
return result; | ||
} | ||
|
||
|
||
bool ListVectorTestFixture::TestListVectorReturnsCorrectGetOtuNamesSize(const std::vector<std::string> &mockListOfSequences, | ||
const int binToTest, const int expectedResult) { | ||
Setup(); | ||
for (const auto& sequences: mockListOfSequences) { | ||
listVector->push_back(sequences); | ||
} | ||
const bool result = listVector->getOTUName(binToTest).size() == expectedResult; | ||
TearDown(); | ||
return result; | ||
} | ||
|
||
void ListVectorTestFixture::Setup() { | ||
listVector = std::make_unique<ListVector>(); | ||
} | ||
|
||
void ListVectorTestFixture::TearDown() { | ||
listVector.reset(); | ||
} |