🏟️

TDD Demo

Tags
C++
ID matched
Created
Jul 13, 2023 10:58 PM
Last Updated
Last updated July 15, 2023
Β 
Β 

ν”„λ‘œμ νŠΈ ꡬ성

  • λ‹€μŒμ˜ λͺ…λ Ήμ–΄λ₯Ό μ‹€ν–‰ν•˜μ—¬ ν”„λ‘œμ νŠΈλ₯Ό κ΅¬μ„±ν•œλ‹€
    • git clone -b minimal https://github.com/SwimingKim/programmers_slam_project_template.git cd programmers_slam_project_template python3 buildDeps.py --password ${PASSWORD} code . # open in vscode
Β 
Β 

CMake λΉŒλ“œ 및 μ‹€ν–‰

  • ν•˜λ‹¨μ˜ CMakeλ₯Ό μ„ νƒν•˜μ—¬ GCCλ₯Ό ν™œμ„±ν™”ν•œλ‹€
    • notion image
  • Release ν˜Ήμ€ Debugλ₯Ό μ„ νƒν•œλ‹€
    • notion image
  • ν•˜λ‹¨μ˜ Build λ²„νŠΌμ„ λˆŒλŸ¬μ„œ CMakeλ₯Ό λΉŒλ“œν•œλ‹€
    • notion image
  • [all] μ˜΅μ…˜μ„ μ„ νƒν•˜μ—¬ unit_tests을 ν™œμ„±ν™”ν•œλ‹€
    • notion image
  • ν•˜λ‹¨μ˜ μ‹€ν–‰ λ²„νŠΌμ„ λˆŒλŸ¬μ„œ unit_tests을 μ‹€ν–‰ν•œλ‹€
    • notion image
  • μ •μƒμ μœΌλ‘œ μ‹€ν–‰ν•˜λŠ” 것을 ν™•μΈν•œλ‹€
    • notion image
Β 
Β 

TDD μ½”λ“œ μž‘μ„±

  • modules/module1/test/sample.cpp νŒŒμΌμ— λ‹€μŒμ˜ μ½”λ“œλ₯Ό μž‘μ„±ν•œλ‹€
    • #include "gtest/gtest.h" TEST(Test_Name_Major, Test_Name_Minor) { constexpr bool evaluation = true; EXPECT_EQ(evaluation, true); EXPECT_EQ(1, 2); EXPECT_TRUE(2 > 3); EXPECT_NEAR(3, -2, 3); }
  • ν…ŒμŠ€νŠΈκ°€ μ‹€νŒ¨λ˜λŠ” 것을 ν™•μΈν•œλ‹€
    • notion image
  • λ‹€μŒ μ½”λ“œλ‘œ λ³€κ²½ν•œλ‹€
    • #include "gtest/gtest.h" TEST(Test_Name_Major, Test_Name_Minor) { constexpr bool evaluation = true; EXPECT_EQ(evaluation, true); EXPECT_EQ(2, 2); EXPECT_TRUE(2 < 3); EXPECT_NEAR(3, -2, 6); }
  • ν…ŒμŠ€νŠΈκ°€ μ„±κ³΅ν•˜λŠ” 것을 ν™•μΈν•œλ‹€
    • notion image
Β 
Β 

μ°Έκ³ 

Β