🤖

Siv3DでVSCodeを使いながら、ユニットテストもしたい(欲張りセット)

に公開

注意事項

この記事は、そこそこにVS2022をちょっと使っている人ではないと理解できません。

vcxprojは手で書くものやる派なので、VS2022を使ったことがない初心者の方は、読まない方がいいですし、やらない方がいいです。
プログラミング初心者だと、プロジェクト壊す可能性もあるので、こんなことを考えてない方がいいです。

何をしたいのか???

  • VS20XX系統って動作重い。もはや起動が面倒。起動している間に寝る。
  • AIちゃんとイチャイチャ♡あんなこと♡こんなこと♡したい♡♡

この記事で出来ないこと

  • VS20XX系統と違いVSCodeでは、ファイルを追加してもvcxprojにファイルを追加しないので、自動でやってほしいにゃん!という方には向きません。

参考資料

VSCode(Windows)向けOpenSiv3D開発環境

https://github.com/sthairno/siv3d_vscode_config

神&神。この記事のほとんどの要素はこちらから来ています。

Catch2の数多の資料

なんかどれもピンとこなかったです。
とりあえず、全部ごった煮しました。

ChatGPTさん

正直♡あんまり役に立たなかったけどぉ♡VSCode把握のヒントになったのでぇ~♡すきすきすき♡♡♡♡♡

やってみよう!

フォルダ構造

ガッチャガッチャ開発用にフォルダ構造を書き換えています。
後、超久しぶりにC++触っているので、王道から外れたファイル名だったら申し訳ございません。
それと、Siv3D初期デフォルトのソースコードです。

  • test
    • Example.cpp
  • include\ui
    • Example.cpp
    • Base.cpp
  • src\ui
    • Example.cpp
  • Main.cpp
  • TestProject.vcxproj

test/Example.cpp

適当に必ずユニットテストエラーが出てくる実装にしています。

test/Example.cpp
#include <ThirdParty/Catch2/catch.hpp>
#include "../include/ui/Example.hpp"

TEST_CASE("TestName", "[tag1][tag2]")
{
	SECTION("Empty")
	{
		Example test = Example();
		REQUIRE(test.TestTest() == 500);
	}
}

include\ui\Example.hpp

UIとなるhppファイル

include\ui\Example.hpp
# include <Siv3D.hpp> // Siv3D v0.6.16
# include "Base.hpp"

class Example : public Base {

	// 画像ファイルからテクスチャを作成する | Create a texture from an image file
	const Texture texture{ U"example/windmill.png" };

	// 絵文字からテクスチャを作成する | Create a texture from an emoji
	const Texture emoji{ U"🦖"_emoji };

	// 太文字のフォントを作成する | Create a bold font with MSDF method
	const Font font{ FontMethod::MSDF, 48, Typeface::Bold };

	// テキストに含まれる絵文字のためのフォントを作成し、font に追加する | Create a font for emojis in text and add it to font as a fallback
	const Font emojiFont{ 48, Typeface::ColorEmoji };

	// ボタンを押した回数 | Number of button presses
	int32 count = 0;

	// チェックボックスの状態 | Checkbox state
	bool checked = false;

	// プレイヤーの移動スピード | Player's movement speed
	double speed = 200.0;

	// プレイヤーの X 座標 | Player's X position
	double playerPosX = 400;

	// プレイヤーが右を向いているか | Whether player is facing right
	bool isPlayerFacingRight = true;

public:
	void Init() override;
	void Update() override;

	/// @brief ユニットテスト用関数
	int TestTest() {
		return 100;
	}
};

include\ui\Base.hpp

ベースとなるhppファイル

include\ui\Base.hpp
class Base {
public:
	/// @brief グラフィック描画前事前処理
	virtual void Init() {};
	/// @brief グラフィック中処理
	virtual void Update() {};
};

Main.cpp

ここで、テストの最初のプログラムを走ります。

Main.cpp
# include <Siv3D.hpp>
# include "include/ui/Example.hpp"

#define CATCH_CONFIG_RUNNER
#include <ThirdParty/Catch2/catch.hpp>

void UnitTest() {
#if UNIT_TEST
	// コンソールを出す必要がある
	Console.open();

	Catch::Session session;
	// テスト後にキー入力を待つための設定
	session.useConfigData({
		.waitForKeypress = Catch::WaitForKeypress::BeforeExit
	});

	// テスト実行
	session.run();
#endif
}

void Main()
{
	UnitTest();
	auto test = Example();
	test.Init();

	while (System::Update())
	{
		test.Update();
	}
}

TestProject.vcxproj

殆どが、初回の機械生成ですが、ところどころ追加されているので、全部載せておきます。
差分表示しているので、分かりやすいでしょ…多分。

TestProject.vcxproj
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Test|x64">
+      <Configuration>Test</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <VCProjectVersion>15.0</VCProjectVersion>
    <ProjectGuid>{33fe8c4d-cd86-479b-860b-10b516a52205}</ProjectGuid>
    <Keyword>Win32Proj</Keyword>
    <RootNamespace>TestProject</RootNamespace>
    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="Shared">
  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64' Or '$(Configuration)|$(Platform)'=='Test|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>$(SolutionDir)Intermediate\$(ProjectName)\Debug\</OutDir>
+    <IntDir>$(SolutionDir)Intermediate\$(ProjectName)\Debug\Intermediate\</IntDir>
+    <TargetName>$(ProjectName)(test)</TargetName>
+    <LocalDebuggerWorkingDirectory>$(ProjectDir)App</LocalDebuggerWorkingDirectory>
+    <IncludePath>$(SIV3D_0_6_16)\include;$(SIV3D_0_6_16)\include\ThirdParty;$(IncludePath)</IncludePath>
+    <LibraryPath>$(SIV3D_0_6_16)\lib\Windows;$(LibraryPath)</LibraryPath>
+  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <LinkIncremental>true</LinkIncremental>
    <OutDir>$(SolutionDir)Intermediate\$(ProjectName)\Debug\</OutDir>
    <IntDir>$(SolutionDir)Intermediate\$(ProjectName)\Debug\Intermediate\</IntDir>
    <TargetName>$(ProjectName)(debug)</TargetName>
    <LocalDebuggerWorkingDirectory>$(ProjectDir)App</LocalDebuggerWorkingDirectory>
    <IncludePath>$(SIV3D_0_6_16)\include;$(SIV3D_0_6_16)\include\ThirdParty;$(IncludePath)</IncludePath>
    <LibraryPath>$(SIV3D_0_6_16)\lib\Windows;$(LibraryPath)</LibraryPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <LinkIncremental>false</LinkIncremental>
    <OutDir>$(SolutionDir)Intermediate\$(ProjectName)\Release\</OutDir>
    <IntDir>$(SolutionDir)Intermediate\$(ProjectName)\Release\Intermediate\</IntDir>
    <LocalDebuggerWorkingDirectory>$(ProjectDir)App</LocalDebuggerWorkingDirectory>
    <IncludePath>$(SIV3D_0_6_16)\include;$(SIV3D_0_6_16)\include\ThirdParty;$(IncludePath)</IncludePath>
    <LibraryPath>$(SIV3D_0_6_16)\lib\Windows;$(LibraryPath)</LibraryPath>
  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Test|x64'">
+    <ClCompile>
+      <WarningLevel>Level4</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>UNIT_TEST;_DEBUG;_WINDOWS;_ENABLE_EXTENDED_ALIGNED_STORAGE;_SILENCE_CXX20_CISO646_REMOVED_WARNING;_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS;_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+      <LanguageStandard>stdcpplatest</LanguageStandard>
+      <DisableSpecificWarnings>26451;26812;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <ForcedIncludeFiles>stdafx.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
+      <BuildStlModules>false</BuildStlModules>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <DelayLoadDLLs>advapi32.dll;crypt32.dll;dwmapi.dll;gdi32.dll;imm32.dll;ole32.dll;oleaut32.dll;opengl32.dll;shell32.dll;shlwapi.dll;user32.dll;winmm.dll;ws2_32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+    </Link>
+    <PostBuildEvent>
+      <Command>xcopy /I /D /Y "$(OutDir)$(TargetFileName)" "$(ProjectDir)App"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <WarningLevel>Level4</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>_DEBUG;_WINDOWS;_ENABLE_EXTENDED_ALIGNED_STORAGE;_SILENCE_CXX20_CISO646_REMOVED_WARNING;_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS;_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
      <MultiProcessorCompilation>true</MultiProcessorCompilation>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <LanguageStandard>stdcpplatest</LanguageStandard>
      <DisableSpecificWarnings>26451;26812;%(DisableSpecificWarnings)</DisableSpecificWarnings>
      <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
      <PrecompiledHeader>Use</PrecompiledHeader>
      <ForcedIncludeFiles>stdafx.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
      <BuildStlModules>false</BuildStlModules>
    </ClCompile>
    <Link>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <SubSystem>Windows</SubSystem>
      <DelayLoadDLLs>advapi32.dll;crypt32.dll;dwmapi.dll;gdi32.dll;imm32.dll;ole32.dll;oleaut32.dll;opengl32.dll;shell32.dll;shlwapi.dll;user32.dll;winmm.dll;ws2_32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
    </Link>
    <PostBuildEvent>
      <Command>xcopy /I /D /Y "$(OutDir)$(TargetFileName)" "$(ProjectDir)App"</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <WarningLevel>Level4</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_ENABLE_EXTENDED_ALIGNED_STORAGE;_SILENCE_CXX20_CISO646_REMOVED_WARNING;_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS;_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
      <MultiProcessorCompilation>true</MultiProcessorCompilation>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <LanguageStandard>stdcpplatest</LanguageStandard>
      <DisableSpecificWarnings>26451;26812;%(DisableSpecificWarnings)</DisableSpecificWarnings>
      <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
      <PrecompiledHeader>Use</PrecompiledHeader>
      <ForcedIncludeFiles>stdafx.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
      <BuildStlModules>false</BuildStlModules>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <SubSystem>Windows</SubSystem>
      <DelayLoadDLLs>advapi32.dll;crypt32.dll;dwmapi.dll;gdi32.dll;imm32.dll;ole32.dll;oleaut32.dll;opengl32.dll;shell32.dll;shlwapi.dll;user32.dll;winmm.dll;ws2_32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
    </Link>
    <PostBuildEvent>
      <Command>xcopy /I /D /Y "$(OutDir)$(TargetFileName)" "$(ProjectDir)App"</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClCompile Include="Main.cpp" />
    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Test|x64'">Create</PrecompiledHeader>
      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
    </ClCompile>
  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="test\Example.cpp">
+      <ObjectFileName>$(IntDir)test\</ObjectFileName>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="src\ui\Main.cpp">
+      <ObjectFileName>$(IntDir)ui\</ObjectFileName>
+    </ClCompile>
+    <ClCompile Include="src\ui\Example.cpp">
+      <ObjectFileName>$(IntDir)ui\</ObjectFileName>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude  Include="include\ui\Base.hpp">
+      <ObjectFileName>$(IntDir)ui\</ObjectFileName>
+    </ClInclude>
+    <ClInclude  Include="include\ui\Main.hpp">
+      <ObjectFileName>$(IntDir)ui\</ObjectFileName>
+    </ClInclude>
+    <ClInclude  Include="include\ui\Example.hpp">
+      <ObjectFileName>$(IntDir)ui\</ObjectFileName>
+    </ClInclude>
+  </ItemGroup>
  <ItemGroup>
    <Image Include="App\engine\texture\box-shadow\128.png" />
    <Image Include="App\engine\texture\box-shadow\16.png" />
    <Image Include="App\engine\texture\box-shadow\256.png" />
    <Image Include="App\engine\texture\box-shadow\32.png" />
    <Image Include="App\engine\texture\box-shadow\64.png" />
    <Image Include="App\engine\texture\box-shadow\8.png" />
    <Image Include="App\example\bay.jpg" />
    <Image Include="App\example\gif\test.gif" />
    <Image Include="App\example\obj\bark.jpg" />
    <Image Include="App\example\obj\leaves.png" />
    <Image Include="App\example\obj\pine_leaves_red.png" />
    <Image Include="App\example\obj\siv3d-kun-eye.png" />
    <Image Include="App\example\obj\siv3d-kun.png" />
    <Image Include="App\example\particle.png" />
    <Image Include="App\example\siv3d-kun.png" />
    <Image Include="App\example\spritesheet\siv3d-kun-16.png" />
    <Image Include="App\example\texture\earth.jpg" />
    <Image Include="App\example\texture\grass.jpg" />
    <Image Include="App\example\texture\ground.jpg" />
    <Image Include="App\example\texture\rock.jpg" />
    <Image Include="App\example\texture\uv.png" />
    <Image Include="App\example\texture\wood.jpg" />
    <Image Include="App\example\windmill.png" />
    <Image Include="App\icon.ico" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="App\Resource.rc" />
  </ItemGroup>
  <ItemGroup>
    <Text Include="App\dll\soundtouch\COPYING.TXT" />
    <Text Include="App\engine\font\fontawesome\LICENSE.txt" />
    <Text Include="App\engine\soundfont\GMGSx.sf2.txt" />
    <Text Include="App\example\font\DotGothic16\OFL.txt" />
    <Text Include="App\example\font\RocknRoll\OFL.txt" />
    <Text Include="App\example\LICENSE.txt" />
    <Text Include="App\example\midi\test.txt" />
    <Text Include="App\example\obj\credit.txt" />
    <Text Include="App\example\spritesheet\siv3d-kun-16.txt" />
    <Text Include="App\example\svg\README.txt" />
    <Text Include="App\example\texture\credit.txt" />
    <Text Include="App\example\txt\en.txt" />
    <Text Include="App\example\txt\jp.txt" />
    <Text Include="App\example\txt\kr.txt" />
    <Text Include="App\example\txt\sc.txt" />
    <Text Include="App\example\video\river.txt" />
  </ItemGroup>
  <ItemGroup>
    <None Include=".editorconfig" />
    <None Include="App\dll\soundtouch\SoundTouch_x64.dll" />
    <None Include="App\engine\font\fontawesome\fontawesome-brands.otf.zstdcmp" />
    <None Include="App\engine\font\fontawesome\fontawesome-solid.otf.zstdcmp" />
    <None Include="App\engine\font\materialdesignicons\license.md" />
    <None Include="App\engine\font\materialdesignicons\materialdesignicons-webfont.ttf.zstdcmp" />
    <None Include="App\engine\font\min\LICENSE" />
    <None Include="App\engine\font\min\siv3d-min.woff" />
    <None Include="App\engine\font\mplus\LICENSE_E" />
    <None Include="App\engine\font\mplus\mplus-1p-black.ttf.zstdcmp" />
    <None Include="App\engine\font\mplus\mplus-1p-bold.ttf.zstdcmp" />
    <None Include="App\engine\font\mplus\mplus-1p-heavy.ttf.zstdcmp" />
    <None Include="App\engine\font\mplus\mplus-1p-light.ttf.zstdcmp" />
    <None Include="App\engine\font\mplus\mplus-1p-medium.ttf.zstdcmp" />
    <None Include="App\engine\font\mplus\mplus-1p-regular.ttf.zstdcmp" />
    <None Include="App\engine\font\mplus\mplus-1p-thin.ttf.zstdcmp" />
    <None Include="App\engine\font\noto-cjk\LICENSE" />
    <None Include="App\engine\font\noto-cjk\NotoSansCJK-Regular.ttc.zstdcmp" />
    <None Include="App\engine\font\noto-cjk\NotoSansJP-Regular.otf.zstdcmp" />
    <None Include="App\engine\font\noto-emoji\LICENSE" />
    <None Include="App\engine\font\noto-emoji\NotoColorEmoji.ttf.zstdcmp" />
    <None Include="App\engine\font\noto-emoji\NotoEmoji-Regular.ttf.zstdcmp" />
    <None Include="App\engine\shader\d3d11\apply_srgb_curve.ps" />
    <None Include="App\engine\shader\d3d11\bitmapfont.ps" />
    <None Include="App\engine\shader\d3d11\copy.ps" />
    <None Include="App\engine\shader\d3d11\forward3d.ps" />
    <None Include="App\engine\shader\d3d11\forward3d.vs" />
    <None Include="App\engine\shader\d3d11\fullscreen_triangle.ps" />
    <None Include="App\engine\shader\d3d11\fullscreen_triangle.vs" />
    <None Include="App\engine\shader\d3d11\gaussian_blur_13.ps" />
    <None Include="App\engine\shader\d3d11\gaussian_blur_5.ps" />
    <None Include="App\engine\shader\d3d11\gaussian_blur_9.ps" />
    <None Include="App\engine\shader\d3d11\line3d.ps" />
    <None Include="App\engine\shader\d3d11\line3d.vs" />
    <None Include="App\engine\shader\d3d11\msdffont.ps" />
    <None Include="App\engine\shader\d3d11\msdffont_outline.ps" />
    <None Include="App\engine\shader\d3d11\msdffont_outlineshadow.ps" />
    <None Include="App\engine\shader\d3d11\msdffont_shadow.ps" />
    <None Include="App\engine\shader\d3d11\msdfprint.ps" />
    <None Include="App\engine\shader\d3d11\quad_warp.ps" />
    <None Include="App\engine\shader\d3d11\quad_warp.vs" />
    <None Include="App\engine\shader\d3d11\round_dot.ps" />
    <None Include="App\engine\shader\d3d11\sdffont.ps" />
    <None Include="App\engine\shader\d3d11\sdffont_outline.ps" />
    <None Include="App\engine\shader\d3d11\sdffont_outlineshadow.ps" />
    <None Include="App\engine\shader\d3d11\sdffont_shadow.ps" />
    <None Include="App\engine\shader\d3d11\shape.ps" />
    <None Include="App\engine\shader\d3d11\sky.ps" />
    <None Include="App\engine\shader\d3d11\sprite.vs" />
    <None Include="App\engine\shader\d3d11\square_dot.ps" />
    <None Include="App\engine\shader\d3d11\texture.ps" />
    <None Include="App\engine\shader\glsl\apply_srgb_curve.frag" />
    <None Include="App\engine\shader\glsl\bitmapfont.frag" />
    <None Include="App\engine\shader\glsl\copy.frag" />
    <None Include="App\engine\shader\glsl\forward3d.frag" />
    <None Include="App\engine\shader\glsl\forward3d.vert" />
    <None Include="App\engine\shader\glsl\fullscreen_triangle.frag" />
    <None Include="App\engine\shader\glsl\fullscreen_triangle.vert" />
    <None Include="App\engine\shader\glsl\gaussian_blur_13.frag" />
    <None Include="App\engine\shader\glsl\gaussian_blur_5.frag" />
    <None Include="App\engine\shader\glsl\gaussian_blur_9.frag" />
    <None Include="App\engine\shader\glsl\line3d.frag" />
    <None Include="App\engine\shader\glsl\line3d.vert" />
    <None Include="App\engine\shader\glsl\msdffont.frag" />
    <None Include="App\engine\shader\glsl\msdffont_outline.frag" />
    <None Include="App\engine\shader\glsl\msdffont_outlineshadow.frag" />
    <None Include="App\engine\shader\glsl\msdffont_shadow.frag" />
    <None Include="App\engine\shader\glsl\msdfprint.frag" />
    <None Include="App\engine\shader\glsl\quad_warp.frag" />
    <None Include="App\engine\shader\glsl\quad_warp.vert" />
    <None Include="App\engine\shader\glsl\round_dot.frag" />
    <None Include="App\engine\shader\glsl\sdffont.frag" />
    <None Include="App\engine\shader\glsl\sdffont_outline.frag" />
    <None Include="App\engine\shader\glsl\sdffont_outlineshadow.frag" />
    <None Include="App\engine\shader\glsl\sdffont_shadow.frag" />
    <None Include="App\engine\shader\glsl\shape.frag" />
    <None Include="App\engine\shader\glsl\sky.frag" />
    <None Include="App\engine\shader\glsl\sprite.vert" />
    <None Include="App\engine\shader\glsl\square_dot.frag" />
    <None Include="App\engine\shader\glsl\texture.frag" />
    <None Include="App\engine\soundfont\GMGSx.sf2.zstdcmp" />
    <None Include="App\example\csv\config.csv" />
    <None Include="App\example\font\DotGothic16\README-JP.md" />
    <None Include="App\example\font\DotGothic16\README.md" />
    <None Include="App\example\font\RocknRoll\README-JP.md" />
    <None Include="App\example\font\RocknRoll\README.md" />
    <None Include="App\example\geojson\countries.geojson" />
    <None Include="App\example\ini\config.ini" />
    <None Include="App\example\json\config.json" />
    <None Include="App\example\json\empty.json" />
    <None Include="App\example\json\invalid-blank.json" />
    <None Include="App\example\json\invalid-syntax.json" />
    <None Include="App\example\json\test.json" />
    <None Include="App\example\midi\test.mid" />
    <None Include="App\example\obj\blacksmith.mtl" />
    <None Include="App\example\obj\crystal1.mtl" />
    <None Include="App\example\obj\crystal2.mtl" />
    <None Include="App\example\obj\crystal3.mtl" />
    <None Include="App\example\obj\mill.mtl" />
    <None Include="App\example\obj\pine.mtl" />
    <None Include="App\example\obj\siv3d-kun.mtl" />
    <None Include="App\example\obj\tree.mtl" />
    <None Include="App\example\script\breakout.as" />
    <None Include="App\example\script\hello.as" />
    <None Include="App\example\script\paint.as" />
    <None Include="App\example\script\piano.as" />
    <None Include="App\example\script\test.as" />
    <None Include="App\example\shader\glsl\default2d.vert" />
    <None Include="App\example\shader\glsl\default2d_shape.frag" />
    <None Include="App\example\shader\glsl\default2d_texture.frag" />
    <None Include="App\example\shader\glsl\default3d_forward.frag" />
    <None Include="App\example\shader\glsl\default3d_forward.vert" />
    <None Include="App\example\shader\glsl\default3d_forward_shadow_depth.frag" />
    <None Include="App\example\shader\glsl\default3d_forward_shadow_shading.frag" />
    <None Include="App\example\shader\glsl\extract_bright_linear.frag" />
    <None Include="App\example\shader\glsl\forward_fog.frag" />
    <None Include="App\example\shader\glsl\forward_triplanar.frag" />
    <None Include="App\example\shader\glsl\game_of_life.frag" />
    <None Include="App\example\shader\glsl\grayscale.frag" />
    <None Include="App\example\shader\glsl\homography.frag" />
    <None Include="App\example\shader\glsl\homography.vert" />
    <None Include="App\example\shader\glsl\multi_texture_blend.frag" />
    <None Include="App\example\shader\glsl\multi_texture_mask.frag" />
    <None Include="App\example\shader\glsl\poisson_disk.frag" />
    <None Include="App\example\shader\glsl\posterize.frag" />
    <None Include="App\example\shader\glsl\rgb_shift.frag" />
    <None Include="App\example\shader\glsl\rgb_to_bgr.frag" />
    <None Include="App\example\shader\glsl\soft_shape.vert" />
    <None Include="App\example\shader\glsl\swirl.frag" />
    <None Include="App\example\shader\glsl\terrain_forward.frag" />
    <None Include="App\example\shader\glsl\terrain_forward.vert" />
    <None Include="App\example\shader\glsl\terrain_normal.frag" />
    <None Include="App\example\svg\cat.svg" />
    <None Include="App\example\svg\turtle.svg" />
    <None Include="App\example\toml\config.toml" />
    <None Include="App\example\toml\test.toml" />
    <None Include="App\example\zip\zip_test.zip" />
  </ItemGroup>
  <ItemGroup>
    <Media Include="App\example\shot.mp3" />
    <Media Include="App\example\test.mp3" />
    <Media Include="App\example\video\river.mp4" />
  </ItemGroup>
  <ItemGroup>
    <Font Include="App\example\font\DotGothic16\DotGothic16-Regular.ttf" />
    <Font Include="App\example\font\RocknRoll\RocknRollOne-Regular.ttf" />
  </ItemGroup>
  <ItemGroup>
    <Xml Include="App\example\objdetect\haarcascade\eye.xml" />
    <Xml Include="App\example\objdetect\haarcascade\face_anime.xml" />
    <Xml Include="App\example\objdetect\haarcascade\frontal_catface.xml" />
    <Xml Include="App\example\objdetect\haarcascade\frontal_face_alt2.xml" />
    <Xml Include="App\example\xml\config.xml" />
    <Xml Include="App\example\xml\test.xml" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="stdafx.h" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App\example\obj\blacksmith.obj">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\obj\crystal1.obj">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\obj\crystal2.obj">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\obj\crystal3.obj">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\obj\mill.obj">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\obj\pine.obj">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\obj\siv3d-kun.obj">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\obj\tree.obj">
      <FileType>Document</FileType>
    </None>
  </ItemGroup>
  <ItemGroup>
    <None Include="App\example\shader\hlsl\default2d.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\default3d_forward.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\default3d_forward_shadow.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\extract_bright_linear.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\forward_fog.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\forward_triplanar.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\game_of_life.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\grayscale.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\homography.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\multi_texture_blend.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\multi_texture_mask.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\poisson_disk.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\posterize.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\rgb_shift.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\rgb_to_bgr.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\soft_shape.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\swirl.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\terrain_forward.hlsl">
      <FileType>Document</FileType>
    </None>
    <None Include="App\example\shader\hlsl\terrain_normal.hlsl">
      <FileType>Document</FileType>
    </None>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>

.vscodeフォルダ

https://github.com/sthairno/siv3d_vscode_config

こちらの.vscodeフォルダをコピー&ペーストします。

.vscode/tasks.json

.vscode/tasks.json
{
    "version": "2.0.0",
    "tasks": [
+        {
+            "label": "Build (Test)",
+            "type": "shell",
+            "command": ".vscode/msbuild.bat",
+            "args": [
+                "/property:GenerateFullPaths=true",
+                "/t:build",
+                "/p:configuration=Test",
+                "/p:platform=x64"
+            ],
+            "group": "build",
+            "presentation": {
+                "reveal": "silent"
+            },
+            "problemMatcher": "$msCompile",
+        },
        {
            "label": "Build (Debug)",
            "type": "shell",
            "command": ".vscode/msbuild.bat",
            "args": [
                "/property:GenerateFullPaths=true",
                "/t:build",
                "/p:configuration=Debug",
                "/p:platform=x64"
            ],
            "group": "build",
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": "$msCompile"
        },
        {
            "label": "Build (Release)",
            "type": "shell",
            "command": ".vscode/msbuild.bat",
            "args": [
                "/property:GenerateFullPaths=true",
                "/t:build",
                "/p:configuration=Release",
                "/p:platform=x64"
            ],
            "group": "build",
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": "$msCompile"
        }
    ]
}

.vscode/lanuch.json

実際に呼び出す時に必要な設定ですねぇ~

.vscode/lanuch.json
{
    "version": "0.2.0",
    "configurations": [
+        {
+            "name": "Launch (Test)",
+            "type": "cppvsdbg",
+            "request": "launch",
+            "program": "${workspaceFolder}/App/${workspaceFolderBasename}(test).exe",
+            "args": [],
+            "cwd": "${workspaceFolder}/App",
+            "environment": [],
+            "preLaunchTask": "Build (Test)",
+        },
        {
            "name": "Launch (Debug)",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${workspaceFolder}/App/${workspaceFolderBasename}(debug).exe",
            "args": [],
            "cwd": "${workspaceFolder}/App",
            "environment": [],
            "preLaunchTask": "Build (Debug)",
        },
        {
            "name": "Launch (Release)",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${workspaceFolder}/App/${workspaceFolderBasename}.exe",
            "args": [],
            "cwd": "${workspaceFolder}/App",
            "environment": [],
            "preLaunchTask": "Build (Release)",
        },
    ]
}

実際のテスト呼び出し

適当に、ビルドの選択欄で「Lanuch(Test)」をクリックで RUN!!!

テスト呼び出した結果

うわ見ずらい!!!!!!
目が目がーーーー!!!!!

結果では、エラーが出ていますが、これは正常です。

test/Example.cppで「REQUIRE(test.TestTest() == 500);」と書いてあって、「testクラスのTestTest()関数が100を戻り値として返す」からですね!

オワリ

本日は、ここで終わりです。乙でした!

Discussion