#include #include #include #include "unity/unity.h" #include "fuse.h" #include "fuseactions.h" fuseArgStruct dummyFuse; int argc = 5; char* argv[5]; void setUp(void) { FuseStructInit(&dummyFuse); argv[0] = "bin/fuse.out"; argv[1] = "-l"; argv[2] = "test/test.txt"; argv[3] = "-f"; argv[4] = "test/fakefs"; } void tearDown(void) { ; } void Test_FuseGetArgs_Should_SetDummyArgs(void) { GetArguments(argc, argv, &dummyFuse); TEST_ASSERT_EQUAL(1, dummyFuse.list); argv[1] = "-a"; GetArguments(argc, argv, &dummyFuse); TEST_ASSERT_EQUAL(1, dummyFuse.add); argv[1] = "-r"; GetArguments(argc, argv, &dummyFuse); TEST_ASSERT_EQUAL(1, dummyFuse.remove); argv[1] = "-e"; GetArguments(argc, argv, &dummyFuse); TEST_ASSERT_EQUAL(1, dummyFuse.extract); } void Test_FindEmptyBitPosition_Should_ReturnPosition(void) { TEST_ASSERT_EQUAL(3, FindEmptyBitPosition(7)); TEST_ASSERT_EQUAL(1, FindEmptyBitPosition(29)); TEST_ASSERT_EQUAL(5, FindEmptyBitPosition(95)); TEST_ASSERT_EQUAL(31, FindEmptyBitPosition(2147483647)); TEST_ASSERT_EQUAL(-1, FindEmptyBitPosition(4294967295)); } int main(void) { UNITY_BEGIN(); RUN_TEST(Test_FuseGetArgs_Should_SetDummyArgs); RUN_TEST(Test_FindEmptyBitPosition_Should_ReturnPosition); return UNITY_END(); }