feladat2 fix 1 + feladat7 start

This commit is contained in:
Damimani 2026-11-20 17:54:51 +01:00
parent 6ca06962d9
commit 3bd4b31b23
18 changed files with 407 additions and 35 deletions

View file

@ -1,4 +1,4 @@
//Tóth Dániel Mátyás | IFPQYY | v2
//Tóth Dániel Mátyás | IFPQYY | v3
#include "pch.h"
#include "CppUnitTest.h"
#include "feladat2.h"
@ -151,6 +151,50 @@ namespace UnitTest1
Assert::AreEqual(4, capacity());
}
TEST_METHOD(RegularOperationTest) {
destroyfifo();
createfifo(6);
push('a');
push('b');
push('c');
push('d');
push('e');
push('f');
Assert::AreEqual(6, capacity());
Assert::AreEqual(0, freespace());
Assert::AreEqual('a', (char)pop());
Assert::AreEqual('b', (char)pop());
Assert::AreEqual('c', (char)pop());
Assert::AreEqual(6, capacity());
Assert::AreEqual(3, freespace());
destroyfifo();
}
TEST_METHOD(SpecialCase1) {//stolen straight from the email
destroyfifo();
createfifo(3);
push(0);
push(1);
push(2);
Assert::AreEqual(3, capacity());
Assert::AreEqual(0, freespace());
Assert::AreEqual(0, pop());
Assert::AreEqual(OK, push((char)255));
Assert::AreEqual(3, capacity());
Assert::AreEqual(0, freespace());
Assert::AreEqual(1, pop());
}
};
}