Permalink
Please sign in to comment.
Showing
with
2,262 additions
and 467 deletions.
- +5 −8 Makefile
- +26 −6 Mothur.xcodeproj/project.pbxproj
- +97 −0 TestMothur/testcommands/testrenamefilecommand.cpp
- +40 −0 TestMothur/testcommands/testrenamefilecommand.h
- +3 −3 makefile-internal
- +1 −1 source/classifier/phylotree.cpp
- +5 −0 source/commandfactory.cpp
- +4 −4 source/commands/chimerauchimecommand.cpp
- +0 −1 source/commands/chimerauchimecommand.h
- +1,642 −0 source/commands/chimeravsearchcommand.cpp
- +66 −0 source/commands/chimeravsearchcommand.h
- +68 −71 source/commands/classifyotucommand.cpp
- +2 −2 source/commands/classifyotucommand.h
- +2 −0 source/commands/clustercommand.cpp
- +4 −4 source/commands/clustersplitcommand.cpp
- +16 −4 source/commands/makebiomcommand.cpp
- +26 −44 source/commands/makecontigscommand.cpp
- +68 −201 source/commands/makecontigscommand.h
- +1 −1 source/commands/pcrseqscommand.cpp
- +72 −28 source/commands/renamefilecommand.cpp
- +7 −2 source/commands/renamefilecommand.h
- +1 −1 source/commands/splitgroupscommand.cpp
- +3 −22 source/commands/summarytaxcommand.cpp
- +1 −1 source/commands/summarytaxcommand.h
- +6 −0 source/datastructures/sequence.cpp
- +1 −0 source/datastructures/sequence.hpp
- +3 −3 source/datastructures/sequencecountparser.cpp
- +1 −1 source/datastructures/sequencecountparser.h
- +3 −3 source/datastructures/sequenceparser.cpp
- +1 −1 source/datastructures/sequenceparser.h
- +22 −16 source/heatmapsim.cpp
- +1 −1 source/heatmapsim.h
- +4 −4 source/mothurout.cpp
- +1 −1 source/mothurout.h
- +8 −0 source/optionparser.cpp
- +6 −4 source/read/splitmatrix.cpp
- +27 −11 source/validparameter.cpp
- +18 −15 source/vsearchfileparser.cpp
- +0 −3 source/weightedlinkage.cpp
| @@ -0,0 +1,97 @@ | ||
| +// | ||
| +// testrenamefilecommand.cpp | ||
| +// Mothur | ||
| +// | ||
| +// Created by Sarah Westcott on 5/4/16. | ||
| +// Copyright (c) 2016 Schloss Lab. All rights reserved. | ||
| +// | ||
| + | ||
| +#include "testrenamefilecommand.h" | ||
| +#include "dataset.h" | ||
| +#include "catch.hpp" | ||
| + | ||
| +/**************************************************************************************************/ | ||
| +TestRenameFileCommand::TestRenameFileCommand() { //setup | ||
| + m = MothurOut::getInstance(); | ||
| + TestDataSet data; | ||
| + filenames = data.getSubsetFNGFiles(100); | ||
| +} | ||
| +/**************************************************************************************************/ | ||
| +TestRenameFileCommand::~TestRenameFileCommand() { | ||
| + for (int i = 0; i < filenames.size(); i++) { m->mothurRemove(filenames[i]); } //teardown | ||
| +} | ||
| +/**************************************************************************************************/ | ||
| +TEST_CASE("Testing RenameFileCommand Class") { | ||
| + TestRenameFileCommand testRename; | ||
| + | ||
| + SECTION("Testing GetNewName - with prefix") { | ||
| + INFO("Using prefix=greatData") // Only appears on a FAIL | ||
| + | ||
| + testRename.prefix = "greatData"; | ||
| + testRename.mothurGenerated = true; | ||
| + | ||
| + CAPTURE(testRename.getNewName(testRename.filenames[0], "fasta")); // Displays this variable on a FAIL | ||
| + | ||
| + CHECK(testRename.getNewName(testRename.filenames[0], "fasta") == "greatData.txt"); | ||
| + | ||
| + testRename.filenames[0] = testRename.getNewName(testRename.filenames[0], "fasta"); //for teardown | ||
| + } | ||
| + | ||
| + SECTION("Testing GetNewName - with user name") { | ||
| + INFO("Using prefix=greatData") // Only appears on a FAIL | ||
| + | ||
| + testRename.outputfile = "greatData.fasta"; | ||
| + testRename.mothurGenerated = false; | ||
| + | ||
| + CAPTURE(testRename.getNewName(testRename.filenames[0], "fasta")); // Displays this variable on a FAIL | ||
| + | ||
| + CHECK(testRename.getNewName(testRename.filenames[0], "fasta") == "greatData.fasta"); | ||
| + | ||
| + testRename.filenames[0] = testRename.getNewName(testRename.filenames[0], "fasta"); //for teardown | ||
| + } | ||
| + | ||
| + | ||
| + SECTION("Testing RenameOrCopy - deleteOld=false") { | ||
| + INFO("Uses mothur rename function to move or system command to copy.") // Only appears on a FAIL | ||
| + | ||
| + testRename.deleteOld = false; | ||
| + | ||
| + testRename.renameOrCopy(testRename.filenames[0], "greatData.new.fasta"); | ||
| + | ||
| + ifstream in, in2; | ||
| + int ableToOpen = testRename.m->openInputFile("greatData.new.fasta", in); | ||
| + in.close(); | ||
| + | ||
| + CAPTURE(ableToOpen); | ||
| + | ||
| + CHECK(ableToOpen == 0); | ||
| + | ||
| + int ableToOpen2 = testRename.m->openInputFile(testRename.filenames[0], in2); | ||
| + in2.close(); | ||
| + | ||
| + CAPTURE(ableToOpen2); | ||
| + | ||
| + CHECK(ableToOpen2 == 0); | ||
| + | ||
| + testRename.m->mothurRemove("greatData.new.fasta"); | ||
| + } | ||
| + | ||
| + SECTION("Testing RenameOrCopy - deleteOld=true") { | ||
| + INFO("Uses mothur rename function to move or system command to copy.") // Only appears on a FAIL | ||
| + | ||
| + testRename.deleteOld = true; | ||
| + | ||
| + testRename.renameOrCopy(testRename.filenames[0], "greatData.new.fasta"); | ||
| + | ||
| + ifstream in, in2; | ||
| + int ableToOpen = testRename.m->openInputFile("greatData.new.fasta", in); | ||
| + in.close(); | ||
| + | ||
| + CAPTURE(ableToOpen); | ||
| + | ||
| + CHECK(ableToOpen == 0); | ||
| + | ||
| + testRename.filenames[0] = testRename.getNewName(testRename.filenames[0], "fasta"); //for teardown | ||
| + } | ||
| +} | ||
| +/**************************************************************************************************/ |
| @@ -0,0 +1,40 @@ | ||
| +// | ||
| +// testrenamefilecommand.h | ||
| +// Mothur | ||
| +// | ||
| +// Created by Sarah Westcott on 5/4/16. | ||
| +// Copyright (c) 2016 Schloss Lab. All rights reserved. | ||
| +// | ||
| + | ||
| +#ifndef __Mothur__testrenamefilecommand__ | ||
| +#define __Mothur__testrenamefilecommand__ | ||
| + | ||
| +#include "renamefilecommand.h" | ||
| + | ||
| +class TestRenameFileCommand : public RenameFileCommand { | ||
| + | ||
| +public: | ||
| + | ||
| + TestRenameFileCommand(); | ||
| + ~TestRenameFileCommand(); | ||
| + | ||
| + | ||
| + MothurOut* m; | ||
| + vector<string> filenames; | ||
| + | ||
| + //private functions | ||
| + using RenameFileCommand::getNewName; | ||
| + using RenameFileCommand::renameOrCopy; | ||
| + | ||
| + //private variables | ||
| + using RenameFileCommand::prefix; | ||
| + using RenameFileCommand::mothurGenerated; | ||
| + using RenameFileCommand::outputfile; | ||
| + using RenameFileCommand::deleteOld; | ||
| + | ||
| + | ||
| + | ||
| +}; | ||
| + | ||
| + | ||
| +#endif /* defined(__Mothur__testrenamefilecommand__) */ |
6
makefile-internal
100755 → 100644
Oops, something went wrong.
0 comments on commit
a591ad7