{"id":164,"date":"2004-03-02T08:49:47","date_gmt":"2004-03-02T13:49:47","guid":{"rendered":"http:\/\/localhost:8888\/index.php\/2005\/03\/14\/palmcunit\/"},"modified":"2013-11-28T09:08:31","modified_gmt":"2013-11-28T14:08:31","slug":"palmcunit","status":"publish","type":"post","link":"https:\/\/www.rickandviv.net\/index.php\/2004\/03\/02\/palmcunit\/","title":{"rendered":"PalmCUnit: A Unit Testing framework for testing Palm apps written in C"},"content":{"rendered":"<p>While working on PalmFrotz, I decided to apply the XP principles that I was using at work.  (In this context, XP stands for eXtreme Programming &#8212; not the Microsoft Operating System.)  I found something called PalmUnit, which is a C++ test runner for Palm.  Since I was not writing PalmFrotz in C++, I didn&#8217;t use that runner.<\/p>\n<p><!--more--><\/p>\n<p>However, I also found source code (at the same website) for a test runner for Palm that was a port of CUnit.  I quickly found that it was lacking some basics of a test runner, so I updated it (fixing some memory leaks and such along the way).  I emailed the original author, but I never heard back from him.  I assume that his version of the code is pretty much abandoned.<\/p>\n<p>So I&#8217;m going to place the source code here for anyone else to use.<\/p>\n<p>Unfortunately, I haven&#8217;t played with Palm programming in some years now.  What is here may only be of historical interest &#8212; I don&#8217;t know what&#8217;s &#8220;state of the art&#8221; for unit testing Palm apps now-a-days.  I don&#8217;t even have the Palm tool chain installed on any of my machines anymore.  So take this code for what it is worth.  But I really liked it when I was using it&#8230;  \ud83d\ude42<\/p>\n<div class=\"break\"><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.rickandviv.net\/wp-content\/uploads\/2008\/02\/palmcunit-showsuccess.jpg\" width=\"160\" height=\"160\" alt=\"palmcunit-showsuccess.jpg\" class=\"imageframe imgalignleft\" \/><br \/>\nAhhh&#8230;  The green bar.  What every XP coder strives for.<\/p>\n<div class=\"break\"><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.rickandviv.net\/wp-content\/uploads\/2008\/02\/palmcunit-showfails.jpg\" width=\"160\" height=\"160\" alt=\"palmcunit-showfails.jpg\" class=\"imageframe imgalignleft\" \/> Here&#8217;s PalmCUnit showing some failures.<\/p>\n<div class=\"break\"><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.rickandviv.net\/wp-content\/uploads\/2008\/02\/palmcunit-showfailure.jpg\" width=\"160\" height=\"160\" alt=\"palmcunit-showfailure.jpg\" class=\"imageframe imgalignleft\" \/> There is a detail screen available for each test that fails.<\/p>\n<div class=\"break\"><\/div>\n<h2>Version History<\/h2>\n<h3>PalmCUnit 1.4.1<\/h3>\n<p>At one point, Ben Combee put a nice article about using PalmCUnit on his website, http:\/\/palmos.combee.net (how <b><u>cool!<\/u><\/b>). In the process, he provided a couple small changes and a .MCP project file for building PalmCUnit in the CodeWarrior V9 environment.  I don&#8217;t have access to CodeWarrior at this time, so I&#8217;m just passing the file on in this package.<\/p>\n<h2>Here&#8217;s a download link: <a href=\"https:\/\/www.rickandviv.net\/wp-content\/uploads\/2008\/02\/palmcunit-141.zip\" title=\"\">PalmCUnit version 1.4.1<\/a><\/h2>\n<h3>PalmCUnit 1.4<\/h3>\n<p>Thanks to Michael Nordstrom at the Plucker project (<a href=\"http:\/\/www.plkr.org\" target=\"_top\">http:\/\/www.plkr.org<\/a>) a few embarrassing bugs have been dealt with.  I guess that&#8217;s to be expected when the author of the code is the only one using it for some time.  Thanks Michael!  Glad to know that someone else is using PalmCUnit!<\/p>\n<h3>PalmCUnit 1.3.2<\/h3>\n<p>The Main GUI pane is a little more friendly &#8212; the &#8220;Runs:&#8221; and &#8220;Failures:&#8221; entries now change dynamically as the tests are run.<\/p>\n<h3>PalmCUnit 1.3.1<\/h3>\n<p>I&#8217;ve made the last suite of tests run to be the default suite on the next launch of the application.  This is very handy when combined with the &#8220;Run tests on app launch&#8221; preference.<\/p>\n<h3>PalmCUnit 1.3<\/h3>\n<p>While adding GUI form testing to my PalmFrotz project, I found that I needed a different style of ASSERT macro: one that allows me to define a section of the code for cleanup at the end of the test.<\/p>\n<p>I&#8217;ve added a set of macros that end in _GOTOERR.  Each of these behaves like their similarly named counterparts, except that instead of just <b>return<\/b>ing to the calling code immediately upon registering the test failure, it branches to a label called <b>ERR:<\/b>.  This was very important in my form unit testing, as I needed to set the tested form as the active<br \/>\nform in order for it to behave correctly in testing.  Of course, if such a test fails, I need it to set the unit testing framework&#8217;s form back to the current active form before exiting the test.<\/p>\n<p>If you&#8217;re not doing this kind of convoluted form testing, you probably don&#8217;t need this update.<\/p>\n<h3>PalmCUnit 1.2.1<\/h3>\n<p>I&#8217;ve found that the application ID that PalmCUnit was using (STRT) is a default ID that is generated by CodeWarrior.  Since I don&#8217;t use CW, I didn&#8217;t notice this.  I&#8217;ve changed the ID to UntT, which I&#8217;ve registered at PalmSource.<\/p>\n<p>No new features have been added to 1.2.<\/p>\n<h3>PalmCUnit 1.2<\/h3>\n<p>I&#8217;ve added a small preferences database that will allow you to set a checkbox that causes the testrunner to automatically run all its tests when it is run.<\/p>\n<p>This has turned out to be very nice for my programming in Falch&#8217;s Developer Studio.  I can just punch one button in the GUI and all my unit tests run!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.rickandviv.net\/wp-content\/uploads\/2008\/02\/palmcunit-showprefs.jpg\" width=\"160\" height=\"160\" alt=\"palmcunit-showprefs.jpg\" class=\"imageframe imgalignleft\" \/> Check the box if you want your tests to automatically run whenever you launch the tester.<\/p>\n<div class=\"break\"><\/div>\n<h3>PalmCUnit 1.1<\/h3>\n<h3>Basic feature list for version 1.1:<\/h3>\n<ul>\n<li>PalmCUnit is now a multisegmented app.  This allows it to test a larger code base.<\/li>\n<li>The code has been restructured to place all the source in the same directory.  This allows for much simpler debugging of source that gets away from you!<\/li>\n<li>PalmCUnit now has the green\/red progress bar that has become standard among other test runners (CppUnit, JUnit, etc.).<\/li>\n<li>There are now pre-test and post-test function callbacks.  Before there were only pre- and post- test suite callback functions.<\/li>\n<li>I added many more ASSERT macros.  There should be enough for most programming needs at this point:\n<ul>\n<li>FAIL()<\/li>\n<li>ASSERT(cond)<\/li>\n<li>ASSERT_MSG(msg,cond)<\/li>\n<li>ASSERT_INT8_EQUAL(exp,act)<\/li>\n<li>ASSERT_INT8_EQUAL_MSG(msg,exp,act)<\/li>\n<li>ASSERT_UINT8_EQUAL(exp,act)<\/li>\n<li>ASSERT_UINT8_EQUAL_MSG(msg,exp,act)<\/li>\n<li>ASSERT_INT16_EQUAL(exp,act)<\/li>\n<li>ASSERT_INT16_EQUAL_MSG(msg,exp,act)<\/li>\n<li>ASSERT_UINT16_EQUAL(exp,act)<\/li>\n<li>ASSERT_UINT16_EQUAL_MSG(msg,exp,act)<\/li>\n<li>ASSERT_INT32_EQUAL(exp,act)<\/li>\n<li>ASSERT_INT32_EQUAL_MSG(msg,exp,act)<\/li>\n<li>ASSERT_UINT32_EQUAL(exp,act)<\/li>\n<li>ASSERT_UINT32_EQUAL_MSG(msg,exp,act)<\/li>\n<li>ASSERT_STR_EQUAL(exp,act)<\/li>\n<li>ASSERT_STR_EQUAL_MSG(msg,exp,act)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>While working on PalmFrotz, I decided to apply the XP principles that I was using at work. (In this context, XP stands for eXtreme Programming &#8212; not the Microsoft Operating System.) I found something called PalmUnit, which is a C++ test runner for Palm. Since I was not writing PalmFrotz in C++, I didn&#8217;t use [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[19],"class_list":["post-164","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-palm"],"_links":{"self":[{"href":"https:\/\/www.rickandviv.net\/index.php\/wp-json\/wp\/v2\/posts\/164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rickandviv.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rickandviv.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rickandviv.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rickandviv.net\/index.php\/wp-json\/wp\/v2\/comments?post=164"}],"version-history":[{"count":3,"href":"https:\/\/www.rickandviv.net\/index.php\/wp-json\/wp\/v2\/posts\/164\/revisions"}],"predecessor-version":[{"id":2473,"href":"https:\/\/www.rickandviv.net\/index.php\/wp-json\/wp\/v2\/posts\/164\/revisions\/2473"}],"wp:attachment":[{"href":"https:\/\/www.rickandviv.net\/index.php\/wp-json\/wp\/v2\/media?parent=164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rickandviv.net\/index.php\/wp-json\/wp\/v2\/categories?post=164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rickandviv.net\/index.php\/wp-json\/wp\/v2\/tags?post=164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}