fuse/test/test.c

48 lines
1008 B
C
Raw Normal View History

#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)
{
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);
return UNITY_END();
}