{"id":900,"date":"2012-10-16T14:17:54","date_gmt":"2012-10-16T19:17:54","guid":{"rendered":"https:\/\/blogs.mathworks.com\/videos\/?p=900"},"modified":"2012-10-16T14:19:37","modified_gmt":"2012-10-16T19:19:37","slug":"simple-test-scripts-in-matlab","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/videos\/2012\/10\/16\/simple-test-scripts-in-matlab\/","title":{"rendered":"Simple test scripts in MATLAB"},"content":{"rendered":"Testing your code is important to make sure that it works correctly and continues to work correctly as you modify it.  The more long lived the code, the more important testing becomes.  \r\n\r\n<p>\r\n<p>\r\nI have found that I often want something very small and lightweight for testing fairly small functions.  Here is an example of a very simple test harness I built for testing one function with a small, but potentially growing, number of tests.  \r\n\r\n<p>\r\n<p>\r\nYou can take a stab at writing your own version of the function I test in the video <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/cody\/problems\/971-siblings-of-a-graphics-object\">here on Cody<\/a>.\r\n<p>\r\n<p>\r\n<div><div class=\"row\"><div class=\"col-xs-12 containing-block\"><div class=\"bc-outer-container add_margin_20\"><videoplayer><div class=\"video-js-container\"><video data-video-id=\"3877436983001\" data-video-category=\"blog\" data-autostart=\"false\" data-account=\"62009828001\" data-omniture-account=\"mathwgbl\" data-player=\"rJ9XCz2Sx\" data-embed=\"default\" id=\"mathworks-brightcove-player\" class=\"video-js\" controls><\/video><script src=\"\/\/players.brightcove.net\/62009828001\/rJ9XCz2Sx_default\/index.min.js\"><\/script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs(\"mathworks-brightcove-player\").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();<\/script><\/div><\/videoplayer><\/div><\/div><\/div>\r\n <\/div>","protected":false},"excerpt":{"rendered":"<div class=\"thumbnail thumbnail_asset asset_overlay video\"><a href=\"https:\/\/blogs.mathworks.com\/videos\/2012\/10\/16\/simple-test-scripts-in-matlab\/?dir=autoplay\"><img decoding=\"async\" src=\"https:\/\/cf-images.us-east-1.prod.boltdns.net\/v1\/static\/62009828001\/55f8100c-1eec-4b60-a52d-efb7484380ca\/6ef3663e-a76e-4be6-b5b1-65138ce6aff3\/1280x720\/match\/image.jpg\" onError=\"this.style.display ='none';\"\/>\n      <div class=\"overlay_container\">\n      <span class=\"icon-video icon_color_null\"><time class=\"video_length\">4:29<\/time><\/span>\n      <\/div>\n      <\/a><\/div><p>Testing your code is important to make sure that it works correctly and continues to work correctly as you modify it.  The more long lived the code, the more important testing becomes.  \r\n\r\n\r\n\r\nI&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/videos\/2012\/10\/16\/simple-test-scripts-in-matlab\/\">read more >><\/a><\/p>","protected":false},"author":68,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,12],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/900"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/users\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/comments?post=900"}],"version-history":[{"count":9,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/900\/revisions"}],"predecessor-version":[{"id":911,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/900\/revisions\/911"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/media?parent=900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/categories?post=900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/tags?post=900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}