1
0
mirror of https://gitlab.com/klmp200/fish.git synced 2025-07-11 20:29:23 +00:00

Début de l'intégration des tests

This commit is contained in:
2017-05-16 00:08:07 +02:00
parent 9b6e5c7bc5
commit 209c36e7fd
11 changed files with 171 additions and 31 deletions

View File

@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.7)
project(fish_shell_tests)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -c")
include_directories(
"${source_dir}/googletest/include"
"${source_dir}/googlemock/include"
)
set(SOURCE_FILES_TESTS main.cpp FishCoreTests.cpp FishCoreTests.h)
add_executable(fish_tests ${SOURCE_FILES_TESTS})
target_link_libraries(fish_tests libgtest libgmock)

View File

@ -0,0 +1,38 @@
//
// Created by Antoine Bartuccio on 15/05/2017.
//
#include "FishCoreTests.h"
//
// Created by Antoine Bartuccio on 15/05/2017.
//
#include "../fish_shell/fish_core.c"
//TEST_F(FishCoreTests, split){
// ASSERT_TRUE(true);
//}
TEST(simple_split, split){
char input[] = "git push --force";
char *output[] = {
(char *) "git",
(char *) "push",
(char *) "--force"
};
WordList *list = split(input, (char *) FISH_TOKENS);
WordListElement *current = list->first;
int i = 0;
ASSERT_FALSE(current == NULL);
while(current != NULL){
ASSERT_STREQ(current->word, output[i]);
current = current->next;
i++;
}
freeWordList(list);
}

View File

@ -0,0 +1,15 @@
//
// Created by Antoine Bartuccio on 15/05/2017.
//
#ifndef FISH_FISH_CORE_TESTS_H
#define FISH_FISH_CORE_TESTS_H
#include <gtest/gtest.h>
class FishCoreTests : public ::testing::Test {
void SetUp() {}
void TearDown(){}
};
#endif //FISH_FISH_CORE_TESTS_H

16
fish_shell_tests/main.cpp Normal file
View File

@ -0,0 +1,16 @@
//
// Created by Antoine Bartuccio on 15/05/2017.
//
#include <gtest/gtest.h>
int main(int argc, char **argv){
printf("Je mange des patates");
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;
}