diff testing/utp_1.1/save_report.m @ 44:409a22968d5e default

Add unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 18:42:11 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testing/utp_1.1/save_report.m	Tue Dec 06 18:42:11 2011 +0100
@@ -0,0 +1,37 @@
+% SAVE_REPORT runs all unit test and saves the result to a readable file
+
+% OLD TODO
+% 
+%   + Format UTP table by hand - not using \utp
+%   + move code block to tables in appendix with same numbering as UTP tables
+%   + add pdf link in UTP table to code block
+%   + keep code indentation from m-file
+%   + wrap strings using utils.prog.wrapstring (or similar) - add ... 
+% 
+
+function save_report()
+  % config
+  csv_filename = 'report/report.csv'; % path to temporary csv file
+  end_filename = 'report/utp_%TIME%.xml'; %where the report goes to
+  ruby = '/usr/bin/ruby'; %path to ruby
+  rb_file = 'buildxml.rb'; %path to buildxml.rb
+
+  % input data (loaded from file)
+  result = load('result.mat');
+  result = result.s;
+  
+  % input data (test run)
+  % result = utp_run();
+  
+  % output
+  outFile = fopen(csv_filename, 'w');
+  
+  for i=1:length(result)
+    line = sprintf('%s, %.0f, %.0f, %.0f, %.0f\n', result(i).fcn, result(i).a, result(i).s, result(i).num, result(i).date.utc_epoch_milli);
+    fprintf(outFile, '%s', line);
+  end
+  
+  fclose(outFile);
+  
+  system(sprintf('%s %s "%s"', ruby, rb_file, end_filename));
+end
\ No newline at end of file