SlideShare una empresa de Scribd logo
1 de 13
Descargar para leer sin conexión
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/

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Destacado

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

Destacado (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
 

Similar a Unit test demo for calculatechinesenamenumber

Similar a 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
 

Más de Juggernaut Liu

Más de 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
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Unit test demo for calculatechinesenamenumber