C# things collected over the years.
Requires VS2022 and .NET6.
No dependencies on external components.
Probably I should make this into a nuget package at some point.
- MmTimerEx: A theoretically better multimedia timer with improved accuracy for sub 10 msec period.
- MultiFileWatcher: Multiple file change watcher.
- TimingAnalyzer: High speed event statistics.
- CommandProcessor.cs: Command line arg parser.
- MathUtils: Numbers are good.
- MiscUtils: Things that don't fit anywhere else.
- Tools: Things that are higher level than MiscUtils, formatters and the like.
- StringUtils: Mostly low-level extensions.
- Dumper: Writes object tree contents.
- MusicDefinitions: Scales and chords.
- Singleton manager.
- Client creates multiple named loggers.
- Log records go to log file and/or notification event hook for UI.
- Note: Be careful with handling notifications - don't call Logger functions in UI constructors as the handle is not assigned and Invoke() will fail.
- A simple IPC server/single-client mechanism is used to send a single string one-way. That's all.
- To support development of the IPC there is a rudimentary cross-process logger.
- Primary usage is for a single instance app (ClipPlayer) to send command args to itself.
Compiles C#-like scripts into in-memory assemblies. Primarily for use by Nebulator and NProcessing. See those repos for example on how to use this.
Practically Nonexistent Unit Tester
A public version of a super lightweight unit test framework for C#. It has gone through many useful and successful iterations and may as well bring you joy also.
Based on a C/C++ version which was inspired by Quicktest from long ago.
See the test suite for how to use this.
File look something like this:
public class PNUT_ONE : TestSuite
{
public override void RunSuite()
{
int int1 = 321;
string str1 = "round and round";
string str2 = "the mulberry bush";
UT_INFO("Suite tests core functions.");
// Should fail on UT_STR_EQUAL.
UT_EQUAL(str1, str2);
// Should pass on UT_STR_EQUAL.
UT_EQUAL(str2, "the mulberry bush");
// Should fail on UT_NOT_EQUAL.
UT_NOT_EQUAL(int1, 321);
}
}
There are two formats supported.
Readable text For humans. ! indicates a test failure.
Test Suite PNUT_1: Test basic check macros
Property version:xyz123
Property rand-seed:999
Visually inspect that this appears in the output with parm == 2. 2
! (c:\dev\pnut\test.cpp:25) PNUT_1.2 [1] should be greater than [2]
! (c:\dev\pnut\test.cpp:43) PNUT_2.3 [round and round] should equal [the mulberry bush]
Inspect Clouseau
! (c:\dev\pnut\test.cpp:69) PNUT_2.15 [1.5] should be within 0.099 of [1.6]
A JUnit style intended for consumption by CI. Not tested yet but looks nice.
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests=21 failures=0 time=00:00:00.012 >
<testsuite name = ETC_33>
<testcase name="ETC_33.1" classname="ETC_33" />
<testcase name="ETC_33.2 " classname="ETC_33">
<failure message="C:\foo\test.cs:113 [lwil/4xG|] != [Should fail]"></failure>
</testcase>
<testcase name="ETC_33.3" classname="ETC_33" />
</testsuite>
</testsuites>