I’m Sam
I’m Sam
May 28, 2017 · 2 min read
[153] JUCE Diary #14:Catch Test Framework

Catch 在 C++ 單元測試、自動化測試領域算是新兵。由於設計優良,使用簡便,近來頗受好評。JUCE 內建了單元測試機制,雖然大部分情況下比夠用還多,不過,為了避免落入「固步自封」的工程師死亡陷阱,偶爾還是要看看窗外的世界,弄髒手,動動腦。

JUCE 論壇經常出現高手分享自己的作品,昨天就看到 varx 這個把 Reactive-Extension, RxCpp 導入到 JUCE 的專案,太有才,改天一定要試試。不過,今天的重點不在該專案,原因是我挖了專案原始碼來看,發現作者用了 Catch 做單元測試,而不是用 JUCE 內建的機制。然後,使用 Catch 來做測試真的很簡單。底下說明使用方式。

首先,使用 Projucer 建一個 Console Application。為什麼要選這個類型的專案?因為「自動產生的程式碼最少」。Main.cpp 長這樣:

中略。

原因是,在 Medium 寫含有程式碼的文章太痛苦了,想看完整版,請移駕主站: http://ift.tt/2r9i1z0

JUCE Tips

A place you don’t want to miss while learning JUCE

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store