Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayak11 authored Oct 1, 2021
1 parent c0b8a66 commit 74b1308
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "pch.h" //TODO
#include<iostream>
using namespace std;

class Check { //constructor
int val;
public:
Check() : val(0) {} //allocating 0 to val
void setValue(int newVal) {
this->val = newVal;
}
int getVal() {
return this->val;
}
};
//TF --> test fixture
struct TF : public testing::Test { //google test
Check* c1;
void SetUp() {
cout << "SETUP" << endl;
c1 = new Check();
}
void TearDown() {
cout << "TEARDOWN" << endl;
delete c1;
}
};


TEST_F(TF, SubTestName) {

//Arrange
// Check* c1 = new Check();

//Act
c1->setValue(100);

//Assert --> fatal
ASSERT_EQ(c1->getVal(),200);

}


TEST_F(TF, SubTestName_1) {

//Act
c1->setValue(500);
//Expect --> non fatal
EXPECT_EQ(c1->getVal(),500);

}

0 comments on commit 74b1308

Please sign in to comment.