2022-11-16 16:08:14 -06:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#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)
|
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2022-11-17 19:43:46 -06:00
|
|
|
void Test_FuseGetArgs_Should_SetDummyArgs(void)
|
2022-11-16 16:08:14 -06:00
|
|
|
{
|
|
|
|
FuseGetArgs(argc, argv, &dummyFuse);
|
|
|
|
TEST_ASSERT_EQUAL(1, dummyFuse.list);
|
|
|
|
argv[1] = "-a";
|
|
|
|
FuseGetArgs(argc, argv, &dummyFuse);
|
|
|
|
TEST_ASSERT_EQUAL(1, dummyFuse.add);
|
|
|
|
argv[1] = "-r";
|
|
|
|
FuseGetArgs(argc, argv, &dummyFuse);
|
|
|
|
TEST_ASSERT_EQUAL(1, dummyFuse.remove);
|
|
|
|
argv[1] = "-e";
|
|
|
|
FuseGetArgs(argc, argv, &dummyFuse);
|
|
|
|
TEST_ASSERT_EQUAL(1, dummyFuse.extract);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
UNITY_BEGIN();
|
2022-11-17 19:43:46 -06:00
|
|
|
RUN_TEST(Test_FuseGetArgs_Should_SetDummyArgs);
|
2022-11-16 16:08:14 -06:00
|
|
|
return UNITY_END();
|
|
|
|
}
|