test rewritten

This commit is contained in:
2016-04-18 16:03:33 +02:00
parent e6a5882e58
commit 9f1f0fe763
11 changed files with 289 additions and 287 deletions

View File

@@ -1,16 +1,17 @@
#include <NeuralNetwork/FeedForward/Perceptron.h>
#include <assert.h>
#include <iostream>
#include <gtest/gtest.h>
int main() {
TEST(Perceptron,Test) {
NeuralNetwork::FeedForward::Perceptron p(2,1);
p[1].weight(0)=-1.0;
p[1].weight(1)=1.001;
assert(p.computeOutput({1,1})[0] == 1.0);
p[1].weight(1)=0.999;
float ret =p.computeOutput({1,1})[0];
ASSERT_EQ(ret, 1.0);
assert(p.computeOutput({1,1})[0] == 0.0);
p[1].weight(1)=0.999;
ret =p.computeOutput({1,1})[0];
ASSERT_EQ(ret, 0.0);
}