From 425bf4689eb1fdd0c37a61aa3344b45054d8ee63 Mon Sep 17 00:00:00 2001 From: NADAL Jean-Baptiste Date: Mon, 29 Jan 2024 14:49:00 +0100 Subject: [PATCH] [WIP] Add skeleton --- .gitignore | 1 + .vscode/c_cpp_properties.json | 18 ++++++++++++++++ .vscode/launch.json | 27 ++++++++++++++++++++++++ CMakeLists.txt | 29 ++++++++++++++++++++++++++ README.md | 5 +++++ tests/chapitre01_tests.cpp | 39 +++++++++++++++++++++++++++++++++++ 6 files changed, 119 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100644 CMakeLists.txt create mode 100644 tests/chapitre01_tests.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..e6cbc98 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compilerPath": "/usr/bin/gcc", + "cStandard": "gnu17", + "cppStandard": "gnu++14", + "intelliSenseMode": "linux-gcc-x64", + "compileCommands": "${workspaceFolder}/build/compile_commands.json", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1f62b74 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Lancer", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/rc_tests", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "console": "externalTerminal", + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Activer l'impression en mode Pretty pour gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..82d2fc8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.14) +project(raytracing_challenge) + +# GoogleTest requires at least C++14 +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +include(FetchContent) +FetchContent_Declare( + googletest + URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip +) +# For Windows: Prevent overriding the parent project's compiler/linker settings +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +FetchContent_MakeAvailable(googletest) + +enable_testing() + +add_executable( + rc_tests + tests/chapitre01_tests.cpp +) +target_link_libraries( + rc_tests + GTest::gtest_main +) + +include(GoogleTest) +gtest_discover_tests(rc_tests) diff --git a/README.md b/README.md index e69de29..02aa3ed 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,5 @@ + + +## Le Livre est ici: + +https://lire.amazon.fr/?asin=B07Q84TQ91&ref_=kwl_kr_iv_rec_1 diff --git a/tests/chapitre01_tests.cpp b/tests/chapitre01_tests.cpp new file mode 100644 index 0000000..65f8d5e --- /dev/null +++ b/tests/chapitre01_tests.cpp @@ -0,0 +1,39 @@ +/*! + * chapitre-01_tests.cpp + * + * Copyright (c) 2015-2024, NADAL Jean-Baptiste. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * @Author: NADAL Jean-Baptiste + * @Date: 07/02/2021 + * + */ + +// This is an independent project of an individual developer. Dear PVS-Studio, please check it. +// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com + +/*---------------------------------------------------------------------------*/ + +#include + +// Demonstrate some basic assertions. +TEST(HelloTest, BasicAssertions) { + // Expect two strings not to be equal. + EXPECT_STRNE("hello", "world"); + // Expect equality. + EXPECT_EQ(7 * 6, 42); +}