SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
Unit Test
姓名學最佳筆畫數為例
Author : Juggernaut Liu
Outline
● Testing framework
● Project Introduction
● Implement Process
● Demo
● Notes
● Reference
Testing framework
● Coding
○ c++
● Googletest
○ https://code.google.com/p/googletest/
● Googlemock
○ https://code.google.com/p/googlemock/
Project Introduction
● 姓名學 - 如何取名
○ http://juggernaut-liu.blogspot.tw/2013/09/rule-1-rule-2-1-2-rule-3-15-x-
6-15-x-6.html
● Project Scope
○ Input : 姓筆畫, 缺五行type
○ Rules:
■ 總格補上缺乏的五行
■ 三才配置
■ 八十一數之靈動
○ Ouput: 用vector存的最佳筆畫數組合
Project Introduction(2)
● CalculateChineseNameProcessor
○ main algorithm
● UnitTest
○ unit test for CalculateChineseNameProcessor
Project Introduction(3)
CalculateChineseNameProcessor
● NameProfile
○ Data structure
● ILoadSettings
○ Loading config from text
● IDataProducer
○ Produce initial data (A lot of NameProfile)
● IRulefilter
○ Each Rulefilter filter out not-matching NameProfiles
● MainProcessor
○ Run all process
Project Introduction(4) class diagram
Implement Process
Steps
1, Design one Interface
2, Write the Unit Test
3, Write the production code
4, Modify interface or test to match the code.
5, Repeat 1,2,3,4 to next feature.
Implement Process(2)
Implement order
1, NameProfile
2, IDataProducer
3, IRuleFilter
4, ILoadSettings
5, MainProcessor
Demo
Notes
● I do not test private code, but I test the public
code which call private code
● TEST vs TEST_F
● SetUpTestCase, TearDownTestCase vs
SetUp, TearDown
● ::testing::FLAGS_gtest_output = "xml:" =>log
Notes(2)
● Each unit test pass the test, but it test error
when I combine them
○ Got 1 bug
● Test sample is too few to test all conditions
○ Miss some conditions
Reference
GitHub
https://github.com/JuggernautLiu/CalculateChineseNameNumber
MyBlog
http://juggernaut-liu.blogspot.tw/2013/09/rule-1-rule-2-1-2-rule-3-15-x-6-15-x-6.
html
Googletest
https://code.google.com/p/googletest/
Googlmock
https://code.google.com/p/googlemock/

Weitere ähnliche Inhalte

Was ist angesagt?

One marks of entrepreneurial development
One marks of entrepreneurial developmentOne marks of entrepreneurial development
One marks of entrepreneurial development
MAHIRA PARVEEN
 
Slope formulatemplatecx
Slope formulatemplatecxSlope formulatemplatecx
Slope formulatemplatecx
Media4math
 

Was ist angesagt? (13)

Web Development Innovations and trends in 2016 - Aleksandr Makhomet
Web Development Innovations and trends in 2016 - Aleksandr MakhometWeb Development Innovations and trends in 2016 - Aleksandr Makhomet
Web Development Innovations and trends in 2016 - Aleksandr Makhomet
 
Sprint 25
Sprint 25Sprint 25
Sprint 25
 
Outbrain Click Prediction
Outbrain Click PredictionOutbrain Click Prediction
Outbrain Click Prediction
 
Switching of GUI Framework: The case from Spec to Spec2
Switching of GUI Framework: The case from Spec to Spec2Switching of GUI Framework: The case from Spec to Spec2
Switching of GUI Framework: The case from Spec to Spec2
 
Recent c++ goodies (March 2018)
Recent c++ goodies (March 2018)Recent c++ goodies (March 2018)
Recent c++ goodies (March 2018)
 
How do you write a program for #24 on pg 244, in "Starting out with C++". It...
How do you write a program for #24 on pg 244, in "Starting out with C++".  It...How do you write a program for #24 on pg 244, in "Starting out with C++".  It...
How do you write a program for #24 on pg 244, in "Starting out with C++". It...
 
TF2.0 & GPflow 2.0
TF2.0 & GPflow 2.0TF2.0 & GPflow 2.0
TF2.0 & GPflow 2.0
 
Life after Matplotlib: Harder, Better, Faster, Stronger by Kayla Lacovino
Life after Matplotlib: Harder, Better, Faster, Stronger by Kayla LacovinoLife after Matplotlib: Harder, Better, Faster, Stronger by Kayla Lacovino
Life after Matplotlib: Harder, Better, Faster, Stronger by Kayla Lacovino
 
Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...
Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...
Nathan Ford- Divination of the Defects (Graph-Based Defect Prediction through...
 
Spec2: How to Build a new GUI
Spec2: How to Build a new GUISpec2: How to Build a new GUI
Spec2: How to Build a new GUI
 
One marks of entrepreneurial development
One marks of entrepreneurial developmentOne marks of entrepreneurial development
One marks of entrepreneurial development
 
Slope formulatemplatecx
Slope formulatemplatecxSlope formulatemplatecx
Slope formulatemplatecx
 
Building parsers in JavaScript
Building parsers in JavaScriptBuilding parsers in JavaScript
Building parsers in JavaScript
 

Andere mochten auch

Design Patterns這樣學就會了:入門班 Day1 教材
Design Patterns這樣學就會了:入門班 Day1 教材Design Patterns這樣學就會了:入門班 Day1 教材
Design Patterns這樣學就會了:入門班 Day1 教材
teddysoft
 

Andere mochten auch (13)

需求怎麼估 20150424新竹scrum社群分享
需求怎麼估 20150424新竹scrum社群分享需求怎麼估 20150424新竹scrum社群分享
需求怎麼估 20150424新竹scrum社群分享
 
Portability
PortabilityPortability
Portability
 
The Practice of Programming - Notation
The Practice of Programming - NotationThe Practice of Programming - Notation
The Practice of Programming - Notation
 
快快樂樂打造自動化開發環境
快快樂樂打造自動化開發環境快快樂樂打造自動化開發環境
快快樂樂打造自動化開發環境
 
別用KPI折磨團隊 - 敏捷團隊的績效評量
別用KPI折磨團隊 - 敏捷團隊的績效評量別用KPI折磨團隊 - 敏捷團隊的績效評量
別用KPI折磨團隊 - 敏捷團隊的績效評量
 
Scrum 路上的血與淚
Scrum 路上的血與淚Scrum 路上的血與淚
Scrum 路上的血與淚
 
ScrumMaster 的吃飯傢伙 – 引導出個夢幻團隊 Building a Dream Team with Facilitation
ScrumMaster 的吃飯傢伙 – 引導出個夢幻團隊 Building a Dream Team with FacilitationScrumMaster 的吃飯傢伙 – 引導出個夢幻團隊 Building a Dream Team with Facilitation
ScrumMaster 的吃飯傢伙 – 引導出個夢幻團隊 Building a Dream Team with Facilitation
 
空手、緊握、到放手 – 敏捷路上學到的5件事
空手、緊握、到放手 – 敏捷路上學到的5件事 空手、緊握、到放手 – 敏捷路上學到的5件事
空手、緊握、到放手 – 敏捷路上學到的5件事
 
提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)
提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)
提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)
 
Design Patterns這樣學就會了:入門班 Day1 教材
Design Patterns這樣學就會了:入門班 Day1 教材Design Patterns這樣學就會了:入門班 Day1 教材
Design Patterns這樣學就會了:入門班 Day1 教材
 
Dev-Ops与Docker的最佳实践 QCon2016 北京站演讲
Dev-Ops与Docker的最佳实践 QCon2016 北京站演讲Dev-Ops与Docker的最佳实践 QCon2016 北京站演讲
Dev-Ops与Docker的最佳实践 QCon2016 北京站演讲
 
ORID焦點討論法 - 白話入門篇
ORID焦點討論法 - 白話入門篇ORID焦點討論法 - 白話入門篇
ORID焦點討論法 - 白話入門篇
 
從廢柴到成材 - 那 20 個 sprints 教會我們的事 C.C Agile #40
從廢柴到成材 - 那 20 個 sprints 教會我們的事 C.C Agile #40從廢柴到成材 - 那 20 個 sprints 教會我們的事 C.C Agile #40
從廢柴到成材 - 那 20 個 sprints 教會我們的事 C.C Agile #40
 

Ähnlich wie Unit test demo for calculatechinesenamenumber

Ähnlich wie Unit test demo for calculatechinesenamenumber (20)

Big data101kagglepresentation
Big data101kagglepresentationBig data101kagglepresentation
Big data101kagglepresentation
 
DataScienceLab2017_Оптимизация гиперпараметров машинного обучения при помощи ...
DataScienceLab2017_Оптимизация гиперпараметров машинного обучения при помощи ...DataScienceLab2017_Оптимизация гиперпараметров машинного обучения при помощи ...
DataScienceLab2017_Оптимизация гиперпараметров машинного обучения при помощи ...
 
Drools & jBPM Workshop London 2013
Drools & jBPM Workshop London 2013Drools & jBPM Workshop London 2013
Drools & jBPM Workshop London 2013
 
JavaScript Getting Started
JavaScript Getting StartedJavaScript Getting Started
JavaScript Getting Started
 
Kubernetes Workload Rebalancing
Kubernetes Workload RebalancingKubernetes Workload Rebalancing
Kubernetes Workload Rebalancing
 
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
 
DA 592 - Term Project Presentation - Berker Kozan Can Koklu - Kaggle Contest
DA 592 - Term Project Presentation - Berker Kozan Can Koklu - Kaggle ContestDA 592 - Term Project Presentation - Berker Kozan Can Koklu - Kaggle Contest
DA 592 - Term Project Presentation - Berker Kozan Can Koklu - Kaggle Contest
 
A Tester's Life
A Tester's LifeA Tester's Life
A Tester's Life
 
Drools & jBPM Workshop Barcelona 2013
Drools & jBPM Workshop  Barcelona 2013Drools & jBPM Workshop  Barcelona 2013
Drools & jBPM Workshop Barcelona 2013
 
CG-Orientation ppt.pptx
CG-Orientation ppt.pptxCG-Orientation ppt.pptx
CG-Orientation ppt.pptx
 
Intro to meteor @py gotham Aug 15-16 2015
Intro to meteor @py gotham Aug 15-16 2015Intro to meteor @py gotham Aug 15-16 2015
Intro to meteor @py gotham Aug 15-16 2015
 
Testing Django APIs
Testing Django APIsTesting Django APIs
Testing Django APIs
 
Building Fullstack Graph Applications With Neo4j
Building Fullstack Graph Applications With Neo4j Building Fullstack Graph Applications With Neo4j
Building Fullstack Graph Applications With Neo4j
 
Data engineering zoomcamp introduction
Data engineering zoomcamp  introductionData engineering zoomcamp  introduction
Data engineering zoomcamp introduction
 
PyCon Poland 2016: Maintaining a high load Python project: typical mistakes
PyCon Poland 2016: Maintaining a high load Python project: typical mistakesPyCon Poland 2016: Maintaining a high load Python project: typical mistakes
PyCon Poland 2016: Maintaining a high load Python project: typical mistakes
 
Testing Spring Applications
Testing Spring ApplicationsTesting Spring Applications
Testing Spring Applications
 
Ukoug webinar - testing PLSQL APIs with utPLSQL v3
Ukoug webinar - testing PLSQL APIs with utPLSQL v3Ukoug webinar - testing PLSQL APIs with utPLSQL v3
Ukoug webinar - testing PLSQL APIs with utPLSQL v3
 
How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...
 
Managing large scale projects in R with R Suite
Managing large scale projects in R with R SuiteManaging large scale projects in R with R Suite
Managing large scale projects in R with R Suite
 
Quality Assurance in PostgreSQL
Quality Assurance in PostgreSQLQuality Assurance in PostgreSQL
Quality Assurance in PostgreSQL
 

Mehr von Juggernaut Liu

Mehr von Juggernaut Liu (15)

2020 MOPCON - How to be Agile
2020 MOPCON - How to be Agile2020 MOPCON - How to be Agile
2020 MOPCON - How to be Agile
 
Design Sprint Case in Trend Micro
Design Sprint Case in Trend MicroDesign Sprint Case in Trend Micro
Design Sprint Case in Trend Micro
 
趨勢科技案例分享 - 與專家一起共舞 Design Sprint
趨勢科技案例分享 - 與專家一起共舞 Design Sprint趨勢科技案例分享 - 與專家一起共舞 Design Sprint
趨勢科技案例分享 - 與專家一起共舞 Design Sprint
 
RPG Retrospective Workshop in AgileTour Hsinchu 2018
RPG Retrospective Workshop in AgileTour Hsinchu 2018RPG Retrospective Workshop in AgileTour Hsinchu 2018
RPG Retrospective Workshop in AgileTour Hsinchu 2018
 
Scrum drawing game in agile summit 2018
Scrum drawing game in agile summit 2018Scrum drawing game in agile summit 2018
Scrum drawing game in agile summit 2018
 
A dev ops team's practice in trend micro in agile summit 2018
A dev ops team's practice in trend micro in agile summit 2018A dev ops team's practice in trend micro in agile summit 2018
A dev ops team's practice in trend micro in agile summit 2018
 
Scrum Drawing Game 2.0 for Agile Tour 2017
Scrum Drawing Game 2.0 for Agile Tour 2017Scrum Drawing Game 2.0 for Agile Tour 2017
Scrum Drawing Game 2.0 for Agile Tour 2017
 
Scrum Drawing Game for Scrum Gathering Tokyo
Scrum Drawing Game for Scrum Gathering TokyoScrum Drawing Game for Scrum Gathering Tokyo
Scrum Drawing Game for Scrum Gathering Tokyo
 
Adapt or Die_devopsdaystaipei_2017
Adapt or Die_devopsdaystaipei_2017Adapt or Die_devopsdaystaipei_2017
Adapt or Die_devopsdaystaipei_2017
 
Null object pattern
Null object patternNull object pattern
Null object pattern
 
在瀑布底下玩Scrum
在瀑布底下玩Scrum在瀑布底下玩Scrum
在瀑布底下玩Scrum
 
Jug EIE Menu presentation
Jug EIE Menu presentationJug EIE Menu presentation
Jug EIE Menu presentation
 
Think on your feet
Think on your feetThink on your feet
Think on your feet
 
Photos in SLC by Juggernaut Liu
Photos in SLC by Juggernaut LiuPhotos in SLC by Juggernaut Liu
Photos in SLC by Juggernaut Liu
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Unit test demo for calculatechinesenamenumber