Scientific Unit Testing
Scientific Unit Testing Dave Steffen, Ph.D. Software Lead in Physics which is relevant dsteffen@scitec.com www.scitec.com 1If I have seen further than others, it is by standing upon the shoulders requirement ... 3Unit Testing OO Code Test using only the public interface ("Black Box" testing) Forces better design ("design for testability") Avoids tight coupling to implementation Unit tests are also also examples and documentation 4Object Oriented testing Let's unit test this class // Cup.h class Cup { public: Cup(); // creates an empty cup bool IsEmpty();0 码力 | 45 页 | 1.91 MB | 5 月前3Back to Basics Unit Testing
1Unit Testing is a Big Topic 2Unit Testing is a Big Topic Jody Hagins (today): The Most Important Design Guideline is Testability Greg Law and Mike Shah (tomorrow): Back To Basics, Debugging and Testing (Wednesday), Making Hard Tests Easy (Robotics Track) Xiaofan Sun (Thursday): Mix Assertion, Logging, Unit Testing and Fuzzing Pete Muldoon (Wednesday) Dependency Injection in C++ "Accelerated TDD" by Rishabh Bisht 3Learning Unit Testing CppCon 2015: T. Winters & H. Wright “All Your Tests are Terrible..." 4Rule 0 Write unit tests 5Part 0: Basics of the Basics Unit testing is the act of testing0 码力 | 109 页 | 4.13 MB | 5 月前3Mix Assertion, Logging, Unit Testing and Fuzzing with ZeroErr
Mix Assertion, Logging, Unit Testing and Fuzzing with ZeroErr Build Safer Modern C++ Application Speaker: Xiaofan Sun Date: Sep 19, 2024Self-Introduction • Got my Ph.D. from UC, Riverside zeroerr::format(__VA_ARGS__)Printing in both Logging & Assertion Smart assertion in user code / unit testing also need pretty printing, e.g.: ASSERT(a != 0, "a should not be 0. Input is: {}", input); LOG("Input is: {}", input); Logging macro:Do I catch the bug? Yes, and it’s inside a unit test case. Then, why the unit test case passed?Another Issue Expr* parseExpr(std::string input) { static std::map0 码力 | 54 页 | 961.46 KB | 5 月前3Testing Compile-time Constructs Within a Runtime Unit Testing Framework
0 码力 | 50 页 | 1.37 MB | 5 月前3Reference guide for RTL units. Document version 3.2.2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 1 Reference for unit ’BaseUnix’ 140 1.1 Used units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 2 Reference for unit ’Character’ 240 2.1 Used units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TCharacter.ToUpper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 3 Reference for unit ’charset’ 258 5 CONTENTS 3.1 Used units . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 2191 页 | 4.93 MB | 1 年前3A Physical Units Library for the Next C++
Units library in a nutshell 5// simple numeric operations static_assert(10_q_km / 2 == 5_q_km); // unit conversions static_assert(1_q_h == 3600_q_s); static_assert(1_q_km + 1_q_m == 1001_q_m); CppCon 2020 Units library in a nutshell 5// simple numeric operations static_assert(10_q_km / 2 == 5_q_km); // unit conversions static_assert(1_q_h == 3600_q_s); static_assert(1_q_km + 1_q_m == 1001_q_m); // dimension Compile-time safety to make sure that the result is of a correct dimension • Support for multiple units and unit prefixes CppCon 2020 | A Physical Units Library For the Next C++ Toy example 12/* speed */ avg_speed(/*0 码力 | 172 页 | 6.17 MB | 5 月前3User’s Guide for Free Pascal, Version 3.2.2
3.1.1 Command line files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1.2 Unit files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1.3 Include files a program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.3 Compiling a unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.4 Units, libraries and . . . . . . . . . 106 8.3 fpdoc - Pascal Unit documenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 8.4 h2pas - C header to Pascal Unit converter . . . . . . . . . . . . . . . .0 码力 | 217 页 | 756.57 KB | 1 年前3Reference guide for FCL units. Document version 3.2.2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 1 Reference for unit ’ascii85’ 89 1.1 Used units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TASCII85RingBuffer.Size . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 2 Reference for unit ’AVL_Tree’ 96 2.1 Used units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.4 TBaseAVLTreeNodeManager.NewNode . . . . . . . . . . . . . . . . . . . . 117 3 Reference for unit ’base64’ 118 3.1 Used units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 953 页 | 2.21 MB | 1 年前3Reference guide for FCL-res units. Document version 3.2.2
resources in object files . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 1 Reference for unit ’acceleratorsresource’ 43 1.1 Used units . . . . . . . . . . . . . . . . . . . . . . . . . . . . TAcceleratorsResource.Items . . . . . . . . . . . . . . . . . . . . . . . . . 47 1 CONTENTS 2 Reference for unit ’bitmapresource’ 48 2.1 Used units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 TBitmapResource.BitmapData . . . . . . . . . . . . . . . . . . . . . . . . . 51 3 Reference for unit ’coffreader’ 52 3.1 Used units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 211 页 | 498.14 KB | 1 年前3Programmer’s Guide for Free Pascal, Version 3.2.2
$THREADNAME : Set thread name in Netware . . . . . . . . . . . . . . . . . 54 1.3.36 $UNITPATH : Specify unit path. . . . . . . . . . . . . . . . . . . . . . . . 54 1.3.37 $VARPROPSETTER : Enable use of var/out/constref 7.2.3 Compiling libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 7.2.4 Unit searching strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 7.3 Using smart linking Pascal preprocessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 A Anatomy of a unit file 148 A.1 Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 187 页 | 531.58 KB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100