1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
//
// testopticluster.cpp
// Mothur
//
// Created by Sarah Westcott on 6/15/16.
// Copyright (c) 2016 Schloss Lab. All rights reserved.
//
#include "testopticluster.h"
#include "distancecommand.h"
#include "dataset.h"
/**************************************************************************************************/
TestOptiCluster::TestOptiCluster() { //setup
m = MothurOut::getInstance();
metric = new MCC();
setVariables(&testMatrix, metric);
}
/**************************************************************************************************/
TestOptiCluster::~TestOptiCluster() { delete metric; }
/**************************************************************************************************/
TEST(Test_Cluster_OptiCluster, myInitialize) {
TestOptiCluster test;
double initialMetricValue;
EXPECT_EQ(0,(test.initialize(initialMetricValue, true, "singleton")));
}
TEST(Test_Cluster_OptiCluster, myUpdate) {
TestOptiCluster test;
double initialMetricValue;
test.initialize(initialMetricValue, false, "singleton"); //no randomization
test.update(initialMetricValue);
//first round
ASSERT_NEAR(1, initialMetricValue, 0.00001); //metric value
test.update(initialMetricValue);
//first round
ASSERT_NEAR(1, initialMetricValue, 0.00001); //metric value
}
TEST(Test_Cluster_OptiCluster, getCloseFarCounts) {
TestOptiCluster test;
double initialMetricValue;
test.initialize(initialMetricValue, false, "singleton"); //no randomization
test.update(initialMetricValue);
vector<long long> results = test.getCloseFarCounts(0, 31);
ASSERT_EQ(results[0], 0); //number of close sequences in bin 31 to seq 0
ASSERT_EQ(results[1], 10); //number of far sequences in bin 31 to seq 0
}
/**************************************************************************************************/
|