File: test_hist.m

package info (click to toggle)
octplot 0.4.0-7
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 3,072 kB
  • ctags: 1,563
  • sloc: cpp: 8,133; ansic: 5,053; sh: 617; makefile: 161
file content (217 lines) | stat: -rwxr-xr-x 5,351 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
## Copyright (C) 2006 Michel D. Schmid
##
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## OctPlot is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with OctPlot; see the file COPYING.  If not, write to the Free
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.


## Author: mds mailto:michaelschmid@users.sourceforge.net

function test_hist

  # set protocol file name
  rowDate = clock();
  strDiaryFileName = [num2str(rowDate(1)) "-" num2str(rowDate(2)) "-" num2str(rowDate(3)) "-" \
	                    num2str(rowDate(4)) "-" num2str(rowDate(5)) "-" num2str(rowDate(6)) \
											"-__hist_test-protocol.txt"];

  diary(strDiaryFileName) # starts the diary into file

	# test hist plots
	disp("Test 1: hist:")
	try # test 1
	  x = 1:10;
	  hist(x);
	  disp("Passed: x = 1:10; hist(x)")
	catch
	  disp("Failed: x = 1:10; hist(x)");
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 2: hist:")
	try # test 2
	  x = 1:10;
	  hist(x,[2 5 7]);
	  disp("Passed: x = 1:10; h = hist(x,[2 5 7])")
	catch
	  disp("Failed: x = 1:10; h = hist(x,[2 5 7])");
	  disp(lasterr);
	end_try_catch
    disp("Please press any button for next test ...")
	pause

	disp("Test 3:")
	try # test 3
	  x = 1:11;
	  hist(x,[0.1 0.4 0.9]);
	  disp("Passed: x = 1:11; hist(x,[0.1 0.4 0.9];")
	catch
	  disp("Passed: x = 1:11; hist(x,[0.1 0.4 0.9];")
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 3.5:")
	try # test 3.5
	  x = 1:11;
	  hist(x,"m");
	  disp("Passed: x = 1:11; hist(x,""m"");")
	catch
	  disp("Passed: x = 1:11; hist(x,""m"");")
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 4:")
	try # test 4
	  x = 1:11;
	  hist(x,5);
	  disp("Passed: x = 1:11; hist(x,5);")
	catch
	  disp("Passed: x = 1:11; hist(x,5);")
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 5:")
	try # test 5
	  x = 1:7;
	  hist(x,[2 4 6],[0.1 0.4 0.9]);
	  disp("Passed: x = 1:7; hist(x,[2 4 6],[0.1 0.4 0.9]);")
	catch
	  disp("Passed: x = 1:7; hist(x,[2 4 6],[0.1 0.4 0.9]);")
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 6:")
	try # test 6
	  x = 1:9;
	  hist(x,[0.1 0.4 0.9],[2 4 6]);
	  disp("Passed: x = 1:9; hist(x,[0.1 0.4 0.9],[2 4 6]);")
	catch
	  disp("Failed: x = 1:9; hist(x,[0.1 0.4 0.9],[2 4 6]);");
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 7:")
	try # test 7
	  x = 1:12;
	  hist(x,9,"g");
	  disp("Passed: x = 1:12; hist(x,9,""g"");")
	catch
	  disp("Failed: x = 1:12; hist(x,9,""g"");");
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 8:")
	try # test 8
	  x = 1:12;
	  hist(x,"y",9);
	  disp("Passed: x = 1:12; hist(x,""g"",9);")
	catch
	  disp("Failed: x = 1:12; hist(x,""g"",9);");
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 9:")
	try # test 9
	  x = 1:12;
	  hist(x,5,9);
	  disp("Passed: x = 1:12; hist(x,5,9);")
	catch
	  disp("Failed: x = 1:12; hist(x,5,9);");
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 10:")
	try # test 10
	  x = 1:12;
	  hist(x,[0.5 0.6 0.5],9,1);
	  disp("Passed: x = 1:12; hist(x,[0.5 0.6 0.5],9,1);")
	catch
	  disp("Failed: x = 1:12; hist(x,[0.5 0.6 0.5],9,1);");
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 11:")
	try # test 11
	  x = 1:12;
	  hist(x,"c",9,1);
	  disp("Passed: x = 1:12; hist(x,""c"",9,1);")
	catch
	  disp("Failed: x = 1:12; hist(x,""c"",9,1);");
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 12:")
	try # test 12
	  x = 1:12;
	  hist(x,[0.5 0.5 0.5],[4 8],1);
	  disp("Passed: x = 1:12; hist(x,[0.5 0.5 0.5],[4 8],1);")
	catch
	  disp("Failed: x = 1:12; hist(x,[0.5 0.5 0.5],[4 8],1);");
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	disp("Test 13:")
	try # test 13
	  x = 1:12;
	  hist(x,[4 8],[0.5 0.95 0.5],1);
	  disp("Passed: x = 1:12; hist(x,[4 8],[0.5 0.95 0.5],1);")
	catch
	  disp("Failed: x = 1:12; hist(x,[4 8],[0.5 0.95 0.5],1);");
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause
	
	disp("Test 14:")
	try
	  x = 1:12;
	  [x,n] = hist(x,[4 8],[0.5 0.95 0.5],1);
	  bar(n,x,n(2)-n(1));
	  disp("Passed: x = 1:12; [x,n] = hist(x,[4 8],[0.5 0.95 0.5],1);bar(n,x,n(2)-n(1));")
	catch
	  disp("Failed: x = 1:12; [x,n] = hist(x,[4 8],[0.5 0.95 0.5],1);bar(n,x,n(2)-n(1));");
	  disp(lasterr);
	end_try_catch
	disp("Please press any button for next test ...")
	pause

	diary off
  

endfunction