Skip to content

Commit e7b3545

Browse files
Added test to check that we have conversion to json.
1 parent 153f3f5 commit e7b3545

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

nuget/SiddiqSoft.WinProcessInfo.nuspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<projectUrl>https://github.com/SiddiqSoft/WinProcessInfo</projectUrl>
1717
<requireLicenseAcceptance>true</requireLicenseAcceptance>
1818
<license type="expression">BSD-3-Clause</license>
19-
<icon>docs\Siddiq-Software-Avatar.png</icon>
20-
<readme>docs\README.md</readme>
19+
<icon>docs\Siddiq-Software-Avatar.png</icon>
20+
<readme>docs\README.md</readme>
2121
<releaseNotes></releaseNotes>
2222
<copyright>Copyright (c) 2021 Siddiq Software LLC</copyright>
2323
<!-- Dependencies -->
@@ -36,7 +36,7 @@
3636
<file src="..\src\*.hpp" target="build\native\include\siddiqsoft\" />
3737
<file src="Siddiq-Software-Avatar.png" target="docs\" />
3838
<file src="..\README.md" target="docs\" />
39-
39+
4040
<!-- MSBuild .targets files -->
4141
<file src="SiddiqSoft.WinProcessInfo.targets" target="build\native" />
4242
</files>

tests/test.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,22 @@ TEST(examples, Example2)
7676
EXPECT_TRUE(false) << e.what(); // if we throw then the test fails.
7777
}
7878
}
79+
80+
TEST(examples, Example3)
81+
{
82+
try
83+
{
84+
siddiqsoft::WinProcessInfo procInfo;
85+
86+
// We must perform the snapshot to obtain memory and thread usage
87+
procInfo.snapshot();
88+
89+
std::cerr << nlohmann::json(procInfo).dump(4) << std::endl;
90+
EXPECT_EQ(GetCurrentProcessId(), nlohmann::json(procInfo).value("processId", 0));
91+
std::cerr << std::format("{} - Contents:{}\n", __func__, procInfo);
92+
}
93+
catch (std::exception& e)
94+
{
95+
EXPECT_TRUE(false) << e.what(); // if we throw then the test fails.
96+
}
97+
}

0 commit comments

Comments
 (0)