test rewritten
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user