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
|
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - INRIA
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
// =============================================================================
// Tests for median function
// =============================================================================
if or( median([1 2 3; 4 5 6],'c') <> [2;5]) then pause, end
if or( median([1 2 3; 4 5 6],'r') <> [2.5 3.5 4.5]) then pause, end
if or( median([1, 2, 3]','r') <> 2 ) then pause, end
if or( median([1, 2, 3],'r') <> [1 2 3]) then pause, end
if or( median([1, 2, 3]','c') <> [1 ; 2 ; 3]) then pause, end
if or( median([1, 2, 3],'c') <> 2) then pause, end
if or( median([1, 2, 3, 4]','c') <> [1 ; 2 ; 3 ; 4]) then pause, end
if or( median([1, 2, 3, 4],'c') <> 2.5) then pause, end
if or( median([1, 2, 3, 4],'r') <> [1 2 3 4]) then pause, end
if or( median([1, 2, 3, 4]','r') <> 2.5) then pause, end
|