SVG Test Document
0 码力 | 5 页 | 11.74 KB | 5 月前3Back to Basics Unit Testing
{ assert( abs( 5) == 5 ); assert( abs(-5) == 5 ); } 1 2 3 4 5 6 7 "Code Under Test" (CUT) "System Under Test" (SUT) Part 0: Basics 7auto abs(int x) -> int { if (x >= 0) return -x; else return Basics 8Unit Test Frameworks Phil Nash Modern C++ Testing with Catch2 Catch2 https://github.com/catchorg/Catch2 Frameworks Part 0: Basics 9auto abs(int x) -> int; math.hpp math.cpp test_math.cpp #include #includetest_macros.hpp> #include "math.hpp" TEST_CASE("Absolute value tests"){ CHECK( abs( 5) == 5); CHECK( abs(-5) == 5); } 1 2 3 4 5 6 7 A test case tests one "thing" about 0 码力 | 109 页 | 4.13 MB | 5 月前3Testing Compile-time Constructs Within a Runtime Unit Testing Framework
testing is a must We use increasingly more compile-time polymorphism and checks Question: how to test if something is compilable in a rigorous way? We use C++ (14) for safety-critical applications return smth / T{2}; }© 2021 Apex.AI, Inc. Write a rigorous testing suite #includeTEST(TestMyApi, Halving) { EXPECT_FLOAT_EQ(21.0F, get_half_of(42.0F)); EXPECT_DOUBLE_EQ(21.0, get_half_of(42 get_half_of(42.0)); }© 2021 Apex.AI, Inc. Even leave a helpful comment #include TEST(TestMyApi, Halving) { EXPECT_FLOAT_EQ(21.0F, get_half_of(42.0F)); EXPECT_DOUBLE_EQ(21.0, get_half_of(42 0 码力 | 50 页 | 1.37 MB | 5 月前3Changing Legacy Code: With Confidence
you write an automated test, you need to make sure the code you are writing works.Test Everything on every feature Write Automated tests and run them continuously Test the change you just made tests and run them continuously Test the change you just made Testing StrategiesTest Everything on every feature Write Automated tests and run them continuously Test the change you just made Testing tests and run them continuously Test the change you just made Testing StrategiesTest Everything on every feature Write Automated tests and run them continuously Test the change you just made Testing0 码力 | 114 页 | 982.54 KB | 5 月前3Scientific Unit Testing
CppCon 2015 Fedor Pikus, Back to Basics: Test-driven Development CppCon 2019 Kevlin Henney: "Structure and Interpretation of Test Cases" NDC Conferences 2019 "Test Smells and Fragrances" DevWeek 2014 run Fast to run TDD Deterministic Code coverage / regulatory requirement ... 3Unit Testing OO Code Test using only the public interface ("Black Box" testing) Forces better design ("design for testability") implementation Unit tests are also examples and documentation 4Object Oriented testing Let's unit test this class // Cup.h class Cup { public: Cup(); // creates an empty cup0 码力 | 45 页 | 1.91 MB | 5 月前3Modern C++ Error Handling
number) { if(c < '0' || c > '9') return false; } return true; } void test(std::string_view str) { if(is_int(str)) std::println("{} is an int", str); else number) { if(c < '0' || c > '9') return false; } return true; } void test(std::string_view str) { if(is_int(str)) std::println("{} is an int", str); else std::println("{} is not an int", str); } 42 is an int 42x is not an int x42 is not an int test("42"); test("42x"); test("x42"); [[nodiscard]]ParseStatus is_int(std::string_view number) { bool first_digit0 码力 | 66 页 | 36.65 MB | 5 月前3Leveraging a Functional Approach for More Testable and Maintainable ROS 2 Code
understand, test, maintain, and extendWhy give this talk? ● Engineers at PickNik experiment with different ways to architect code that uses ROS 2 – creating code that is easy to understand, test, maintain with different ways to architect code that uses ROS 2 – creating code that is easy to understand, test, maintain, and extend ● At the end of a services project, code is handed over to the client ● How with different ways to architect code that uses ROS 2 – creating code that is easy to understand, test, maintain, and extend ● At the end of a services project, code is handed over to the client ● How0 码力 | 200 页 | 1.77 MB | 5 月前3The Most Important Design Guideline is Testability
that the issue is hidden state. I then have to find ways to expose and manipulate that state in test cases. Sometimes that causes new problems typically exposing interfaces that exist solely for unit that the issue is hidden state. I then have to find ways to expose and manipulate that state in test cases. Sometimes that causes new problems typically exposing interfaces that exist solely for unit that the issue is hidden state. I then have to find ways to expose and manipulate that state in test cases. Sometimes that causes new problems typically exposing interfaces that exist solely for unit0 码力 | 126 页 | 9.11 MB | 5 月前3Noexcept: Enabling Testing of Contract Checks
they are for • The importance of writing contracts and checking them at run time • How to unit test contract-checking annotations (CCAs) • How noexcept interacts with unit testing of CCAs. We will audio 19 Copyright (c) Timur Doumler | @timur_audio | https://timur.audio Let's unit-test a function with a narrow contractCopyright (c) Timur Doumler | @timur_audio | https://timur audio Let's unit-test a function with a narrow contract: std::vector::front()Copyright (c) Timur Doumler | @timur_audio | https://timur.audio // vector.h 21 // vector_test.cpp Copyright0 码力 | 90 页 | 1.38 MB | 5 月前3Back to Basics Testing
NASH Testing 1What is a test? 8operation test? What is a 9operation input values + test? What is a 10What is a operation input values + expected output values test? 11What is a operation operation input values expected output values test? ASSERT_EQ( add(1, 2), 3 ); 12What is a operation input values expected output values test? 13 I run my program I type in some input I expect it outputWhat is a operation input values expected output values test? 14 Invoke the compiler give it my code It compiles successfullyWhat is a test? 15 Acceptance Accessibility Active Ad-hoc Age Agile0 码力 | 79 页 | 25.86 MB | 5 月前3
共 200 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20