I am constantly forgetting what the special little codes are for formatting .NET strings. Either through ToString() or using String.Format(). Alignment, padding, month vs. minute (month is uppercase M?), abbreviation vs. full word, etc. I can never remember.
I have the same problem with regexes, but luckily there's Expresso to help me out. It's awesome.
Is there a tool like Expresso for experimenting with formatted strings on standard types like DateTime and float and so on?
Qase. Qase is also a cloud computing-based project management tool, which works excellently for determining the Test Coverage periodically identified for the Test Management process.
It is pretty common to test C code using a C++ testing frameworks, even the leading book on the subject follows this approach. I have used googletest extensively in the past to unit test C code and can recommend it.
A Unit Testing Framework for C CUnit is a lightweight system for writing, administering, and running unit tests in C. It provides C programmers a basic testing functionality with a flexible variety of user interfaces. CUnit is built as a static library which is linked with the user's testing code.
PowerShell works great for testing format strings. From PowerShell you can load your assembly and work with the objects and methods you want to test. You could also just create a string on the command line and test out different formatting options.
You can use the static method from the string class:
$teststring = 'Currency - {0:c}. And a date - {1:ddd d MMM}. And a plain string - {2}'
[string]::Format($teststring, 160.45, Get-Date, 'Test String')
Or PowerShell has a built in format operator
$teststring = 'Currency - {0:c}. And a date - {1:ddd d MMM}. And a plain string - {2}'
$teststring -f 160.45, Get-Date, 'Test String'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With