Mercurial > octave-nkf
changeset 13192:968e89b45bbf
move tests for classes into subdirectories
* classes/test_classes.m: Rename from test_classes.m.
* classes/module.mk: New file with contents from @Blork/module.mk,
@Dork/module.mk, @Pork/module.mk, @Snork/module.mk, @Cork/module.mk,
@Gork/module.mk, @Sneetch/module.mk, and @Spork/module.mk.
(classes_FCN_FILES): Include test_classes.m in the list.
* @Blork/module.mk, @Dork/module.mk, @Pork/module.mk,
@Snork/module.mk, @Cork/module.mk, @Gork/module.mk,
@Sneetch/module.mk, @Spork/module.mk: Delete.
* ctor-vs-method/test_ctor_vs_method.m: Rename from test_ctor_vs_method.m.
* ctor-vs-method/module.mk (ctor_vs_method_FCN_FILES): Include
test_ctor_vs_method.m in the list.
* test/Makefile.am (FCN_FILES): Remove test_classes.m and
test_ctor_vs_method.m from the list.
Don't include @Blork/module.mk,
@Dork/module.mk, @Pork/module.mk, @Snork/module.mk, @Cork/module.mk,
@Gork/module.mk, @Sneetch/module.mk, @Spork/module.mk.
Do include classes/module.mk and ctor-vs-method/module.mk.
* fntests.m (run_test_dir): Also skip private directories and
directories with names that begin with "@".
Work recursively. Change to test directory when running tests.
line wrap: on
line diff
--- a/test/@Blork/Blork.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -function [ s ] = Blork( bleek ) -% Test class. - - if (nargin==1) && isa(bleek, 'Blork') - s = bleek; - else - if nargin==0 - s.bleek = 1; - else - s.bleek = bleek; - end - s = class(s, 'Blork'); - - end - -end
--- a/test/@Blork/bleek.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ out ] = bleek( in, val ) - - if (nargin==1) - out = in.bleek; - else - in.bleek = val; - out = in; - end - -end
--- a/test/@Blork/display.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -function display( s ) - - disp([inputname(1),'.bleek = ']) - disp(' '); - disp(s.bleek); - -end \ No newline at end of file
--- a/test/@Blork/get.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ v ] = get( s, propName ) - - switch propName - case 'bleek' - v = s.bleek; - otherwise - error([propName, ' is not a valid Blork property']); - end - -end
--- a/test/@Blork/module.mk Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -at_Blork_FCN_FILES = \ - @Blork/Blork.m \ - @Blork/bleek.m \ - @Blork/display.m \ - @Blork/get.m \ - @Blork/set.m - -FCN_FILES += $(at_Blork_FCN_FILES)
--- a/test/@Blork/set.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -function [ s ] = set( s, varargin ) - - propArgs = varargin; - while (length(propArgs) >= 2) - propName = propArgs{1}; - propValue = propArgs{2}; - propArgs = propArgs(3:end); - switch propName - case 'bleek' - s.bleek = propValue; - otherwise - error([propName, ' is not a valid Blork property']); - end - end - -end
--- a/test/@Cork/Cork.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -function [ s ] = Cork( click ) -% Test class. - - if ( (nargin==1) && (isa(click, 'Cork')) ) - s = click; - return; - end - - if( nargin<1 ) - s.click = 1; - else - s.click = click; - end - s = class(s, 'Cork'); - -end
--- a/test/@Cork/click.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ out ] = click( in, val ) - - if (nargin==1) - out = in.click; - else - in.click = val; - out = in; - end - -end
--- a/test/@Cork/display.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -function display( s ) - - disp([inputname(1),'.click = ']); - disp(' '); - disp(s.click); - -end \ No newline at end of file
--- a/test/@Cork/get.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ v ] = get( s, propName ) - - switch propName - case 'click' - v = s.click; - otherwise - error([propName, ' is not a valid Cork property']); - end - -end
--- a/test/@Cork/module.mk Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -at_Cork_FCN_FILES = \ - @Cork/Cork.m \ - @Cork/click.m \ - @Cork/display.m \ - @Cork/get.m \ - @Cork/set.m - -FCN_FILES += $(at_Cork_FCN_FILES)
--- a/test/@Cork/set.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -function [ s ] = set( s, varargin ) - - propArgs = varargin; - while (length(propArgs) >= 2) - propName = propArgs{1}; - propValue = propArgs{2}; - propArgs = propArgs(3:end); - switch propName - case 'click' - s.click = propValue; - otherwise - error([propName, ' is not a valid Cork property']); - end - end - -end
--- a/test/@Dork/Dork.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -function [ s ] = Dork( gick, gack ) - - if (nargin==1) && isa(gick,'Dork') - s = gick; - else - s.gack = 0; - if nargin == 0 - s0 = Snork(); - elseif nargin==1 - s0 = Snork(gick); - else - s0 = Snork(gick); - s.gack = gack; - end - s = class(s,'Dork',s0); - end - -end
--- a/test/@Dork/bling.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = bling( m1, m2 ) - - out = 1; - -end
--- a/test/@Dork/display.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -function display( s ) -% Display the critical info for an amplifier - - gick = get(s,'gick'); - disp([inputname(1),'.gick = ']) - disp(' '); - disp(gick); - disp(' '); - disp([inputname(1),'.gack = ']) - disp(' '); - disp(s.gack); - -end
--- a/test/@Dork/gack.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ out ] = gack( in, val ) - - if (nargin==1) - out = in.gack; - else - in.gack = val; - out = in; - end - -end
--- a/test/@Dork/get.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ v ] = get( s, propName ) - - switch propName - case 'gack' - v = s.gack; - otherwise - v = get(s.Snork,propName); - end - -end
--- a/test/@Dork/getStash.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = getStash(cls) - - out = myStash(); - -end
--- a/test/@Dork/module.mk Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -at_Dork_FCN_FILES = \ - @Dork/Dork.m \ - @Dork/bling.m \ - @Dork/display.m \ - @Dork/gack.m \ - @Dork/get.m \ - @Dork/getStash.m \ - @Dork/set.m \ - @Dork/private/myStash.m - -FCN_FILES += $(at_Dork_FCN_FILES)
--- a/test/@Dork/private/myStash.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = myStash() - - out = 2; - -end
--- a/test/@Dork/set.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -function [ s ] = set( s, varargin ) - - propArgs = varargin; - while (length(propArgs) >= 2) - propName = propArgs{1}; - propValue = propArgs{2}; - propArgs = propArgs(3:end); - switch propName - case 'gack' - s.gack = propValue; - otherwise - s.Snork = set(s.Snork, propName, propValue); - end - end - -end
--- a/test/@Gork/Gork.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -function [ s ] = Gork( g ) - if (nargin==1) && isa(g,'Gork') - s = sprk; - return; - end - - drk = Dork(); - prk = Pork(); - blrk = Blork(); - s.Cork = Cork(17); % Aggregation. - s.gark = -2; - s.gyrk = -3; - s = class(s,'Gork',drk,prk,blrk); - -end
--- a/test/@Gork/cork.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ out ] = cork( in, val ) - - if (nargin==1) - out = in.Cork; - else - in.Cork = val; - out = in; - end - -end
--- a/test/@Gork/display.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -function display( s ) -% Display the critical info for a Gork. - - dork_base = s.Dork - %pork_base = s.Pork - %sprk = s.sprk; - gark = get(s,'gark'); - disp([inputname(1),'.gark = ']) - disp(' '); - disp(gark); - disp([inputname(1),'.Cork= ']) - disp(' '); - disp(click(s.Cork)); - - -end
--- a/test/@Gork/gark.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ out ] = gark( in, val ) - - if (nargin==1) - out = in.gark; - else - in.gark = val; - out = in; - end - -end
--- a/test/@Gork/get.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -function [ v ] = get( s, propName ) - - switch propName - case 'cork' - v = s.Cork; - case 'gark' - v = s.gark; - otherwise - % Note that get/set for multiple parents is hard. We only do one - % branch of the parent tree just to test this stuff out. - v = get(s.Dork,propName); - end - -end
--- a/test/@Gork/module.mk Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -at_Gork_FCN_FILES = \ - @Gork/Gork.m \ - @Gork/cork.m \ - @Gork/display.m \ - @Gork/gark.m \ - @Gork/get.m \ - @Gork/set.m \ - @Gork/subsasgn.m \ - @Gork/subsref.m - -FCN_FILES += $(at_Gork_FCN_FILES)
--- a/test/@Gork/set.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -function [ s ] = set( s, varargin ) - - propArgs = varargin; - while (length(propArgs) >= 2) - propName = propArgs{1}; - propValue = propArgs{2}; - propArgs = propArgs(3:end); - switch propName - case 'cork' - if(isa(propValue,'Cork')) - s.Cork = propValue; - else - s.Cork = set(s.Cork, 'click',propValue); - end - case 'gark' - s.gark = propValue; - otherwise - % Note that get/set for multiple parents is hard. We only do one - % branch of the parent tree just to test this stuff out. - s.Dork = set(s.Dork, propName, propValue); - end - end - -end
--- a/test/@Gork/subsasgn.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -function g = subsasgn(g, s, x) - - switch s.type - case '.' - switch s.subs - case 'gyrk' - g.gyrk = x; - end -end
--- a/test/@Gork/subsref.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -function x = subsref(g, s) - - switch s.type - case '.' - switch s.subs - case 'gyrk' - x = g.gyrk; - end -end
--- a/test/@Pork/Pork.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -function [ s ] = Pork( geek, gurk ) - - if (nargin==1) && isa(geek,'Pork') - s = geek; - else - s.gurk = 0; - if nargin == 0 - s0 = Spork(); - elseif nargin==1 - s0 = Spork(geek); - else - s0 = Spork(geek); - s.gurk = gurk; - end - s = class(s,'Pork',s0); - end - superiorto('Dork'); - -end
--- a/test/@Pork/bling.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = bling( m1, m2 ) - - out = 2; - -end
--- a/test/@Pork/display.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -function display( s ) -% Display the critical info for an amplifier - - geek = get(s,'geek'); - disp([inputname(1),'.geek = ']) - disp(' '); - disp(geek); - disp(' '); - disp([inputname(1),'.gurk = ']) - disp(' '); - disp(s.gurk); - -end
--- a/test/@Pork/get.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ v ] = get( s, propName ) - - switch propName - case 'gurk' - v = s.gurk; - otherwise - v = get(s.Spork,propName); - end - -end
--- a/test/@Pork/gurk.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ out ] = gurk( in, val ) - - if (nargin==1) - out = in.gurk; - else - in.gurk = val; - out = in; - end - -end
--- a/test/@Pork/module.mk Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -at_Pork_FCN_FILES = \ - @Pork/Pork.m \ - @Pork/bling.m \ - @Pork/display.m \ - @Pork/get.m \ - @Pork/gurk.m \ - @Pork/set.m \ - @Pork/private/myStash.m - -FCN_FILES += $(at_Pork_FCN_FILES)
--- a/test/@Pork/private/myStash.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = myStash() - - out = 4; - -end
--- a/test/@Pork/set.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -function [ s ] = set( s, varargin ) - - propArgs = varargin; - while (length(propArgs) >= 2) - propName = propArgs{1}; - propValue = propArgs{2}; - propArgs = propArgs(3:end); - switch propName - case 'gurk' - s.gurk = propValue; - otherwise - s.Spork = set(s.Spork, propName, propValue); - end - end - -end
--- a/test/@Sneetch/Sneetch.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -function [ s ] = Sneetch( mcbean ) -% Test class: should produce error. - - if (nargin==1) && isa(mcbean, 'Sneetch') - s = mcbean; - else - if nargin==0 - s.mcbean = 1; - else - s.mcbean = mcbean; - end - s = class(s, 'Sneetch'); - s.sylvester = 1; - end - -end
--- a/test/@Sneetch/display.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function display( s ) - - disp([inputname(1),'.mcbean = ']) - disp(' '); - disp(s.mcbean); - disp([inputname(1),'.sylvester = ']) - disp(' '); - disp(s.sylvester); - -end \ No newline at end of file
--- a/test/@Sneetch/module.mk Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -at_Sneetch_FCN_FILES = \ - @Sneetch/Sneetch.m \ - @Sneetch/display.m - -FCN_FILES += $(at_Sneetch_FCN_FILES)
--- a/test/@Snork/Snork.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -function [ s ] = Snork( gick ) -% Test class. - - if ( (nargin==1) && (isa(gick, 'Snork')) ) - s = gick; - else - s.cack = [0 1 2 3]; - if nargin==0 - s.gick = 1; - else - s.gick = gick; - end - s = class(s, 'Snork'); - - end - -end
--- a/test/@Snork/cack.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = cack( in ) - - out = in.cack; - -end
--- a/test/@Snork/display.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -function display( s ) - - disp([inputname(1),'.gick = ']); - disp(' '); - disp(s.gick); - -end \ No newline at end of file
--- a/test/@Snork/end.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -function r = end (snk, index_pos, num_indices) - - if (num_indices ~= 1) - error ('Snork object may only have one index') - end - - r = length (snk.cack); - -end
--- a/test/@Snork/get.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ v ] = get( s, propName ) - - switch propName - case 'gick' - v = s.gick; - otherwise - error([propName, ' is not a valid Snork property']); - end - -end
--- a/test/@Snork/getStash.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = getStash(cls) - - out = myStash(); - -end
--- a/test/@Snork/gick.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ out ] = gick( in, val ) - - if (nargin==1) - out = in.gick; - else - in.gick = val; - out = in; - end - -end
--- a/test/@Snork/loadobj.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -function [ out ] = loadobj( in ) - - out = in; - out.cack = [-1 -2 -3 -4]; - -end
--- a/test/@Snork/module.mk Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -at_Snork_FCN_FILES = \ - @Snork/Snork.m \ - @Snork/cack.m \ - @Snork/display.m \ - @Snork/end.m \ - @Snork/get.m \ - @Snork/getStash.m \ - @Snork/gick.m \ - @Snork/loadobj.m \ - @Snork/saveobj.m \ - @Snork/set.m \ - @Snork/subsasgn.m \ - @Snork/subsindex.m \ - @Snork/subsref.m \ - @Snork/private/myStash.m - -FCN_FILES += $(at_Snork_FCN_FILES)
--- a/test/@Snork/private/myStash.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = myStash() - - out = 1; - -end
--- a/test/@Snork/saveobj.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -function [ out ] = saveobj( in ) - - out = in; - out.cack = []; - -end
--- a/test/@Snork/set.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -function [ s ] = set( s, varargin ) - - propArgs = varargin; - while (length(propArgs) >= 2) - propName = propArgs{1}; - propValue = propArgs{2}; - propArgs = propArgs(3:end); - switch propName - case 'gick' - s.gick = propValue; - otherwise - error([propName, ' is not a valid Snork property']); - end - end - -end
--- a/test/@Snork/subsasgn.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -function snk = subsasgn (snk, s, val) - if (length (s) < 1) - error ('Snork: needs index'); - end - switch (s(1).type) - case '()' - ind = s(1).subs; - if (numel (ind) ~= 1) - error ('Snork: need exactly one index'); - else - if (length (s) == 1) - snk.cack(ind{1}) = val; - else - error ('Snork: chained subscripts not allowed for {}'); - end - end - case '{}' - ind = s(1).subs; - if (numel (ind) ~= 1) - error ('Snork: need exactly one index'); - else - if (length (s) == 1) - snk.cack(ind{1}) = val; - else - error ('Snork: chained subscripts not allowed for {}'); - end - end - case '.' - fld = s(1).subs; - if (strcmp (fld, 'gick')) - snk.gick = val; - else - error ('Snork/subsasgn: invalid property \"%s\"', fld); - end - otherwise - error ('invalid subscript type'); - end -end
--- a/test/@Snork/subsindex.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = subsindex( obj ) - - out = 0; - -end
--- a/test/@Snork/subsref.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -function b = subsref (snk, s) - if (isempty (s)) - error ('Snork: missing index'); - end - switch (s(1).type) - case '()' - ind = s(1).subs; - if (numel (ind) ~= 1) - error ('Snork: need exactly one index'); - else - b = snk.cack(ind{1}); - end - case '{}' - ind = s(1).subs; - if (numel (ind) ~= 1) - error ('Snork: need exactly one index'); - else - b = snk.cack(ind{1}); - end - case '.' - fld = s.subs; - if (strcmp (fld, 'gick')) - b = snk.gick; - else - error ('Snork/subsref: invalid property \"%s\"', fld); - end - otherwise - error ('invalid subscript type'); - end -end
--- a/test/@Spork/Spork.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -function [ s ] = Spork( geek ) -% Test class. - - if (nargin==1) && isa(geek, 'Spork') - s = geek; - else - s.cack = [-1 -2 -3 -4]; - if nargin==0 - s.geek = 1; - else - s.geek = geek; - end - s = class(s, 'Spork'); - - end - -end
--- a/test/@Spork/cack.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = cack( in ) - - out = in.cack; - -end
--- a/test/@Spork/display.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -function display( s ) - - disp([inputname(1),'.geek = ']) - disp(' '); - disp(s.geek); - -end \ No newline at end of file
--- a/test/@Spork/geek.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ out ] = geek( in, val ) - - if (nargin==1) - out = in.geek; - else - in.geek = val; - out = in; - end - -end
--- a/test/@Spork/get.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -function [ v ] = get( s, propName ) - - switch propName - case 'geek' - v = s.geek; - otherwise - error([propName, ' is not a valid Spork property']); - end - -end
--- a/test/@Spork/getStash.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = getStash(cls) - - out = myStash(); - -end
--- a/test/@Spork/loadobj.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -function [ out ] = loadobj( in ) - - out = in; - if (~isa(in,'Spork')) - out.cack=[]; - end - -end
--- a/test/@Spork/module.mk Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -at_Spork_FCN_FILES = \ - @Spork/Spork.m \ - @Spork/cack.m \ - @Spork/display.m \ - @Spork/geek.m \ - @Spork/get.m \ - @Spork/getStash.m \ - @Spork/loadobj.m \ - @Spork/saveobj.m \ - @Spork/set.m \ - @Spork/private/myStash.m - -FCN_FILES += $(at_Spork_FCN_FILES)
--- a/test/@Spork/private/myStash.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function [ out ] = myStash() - - out = 3; - -end
--- a/test/@Spork/saveobj.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -function [ out ] = saveobj( in ) - - out = in; - %rmfield(out,'cack'); - -end
--- a/test/@Spork/set.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -function [ s ] = set( s, varargin ) - - propArgs = varargin; - while (length(propArgs) >= 2) - propName = propArgs{1}; - propValue = propArgs{2}; - propArgs = propArgs(3:end); - switch propName - case 'geek' - s.geek = propValue; - otherwise - error([propName, ' is not a valid Spork property']); - end - end - -end
--- a/test/Makefile.am Thu Sep 22 16:01:28 2011 -0500 +++ b/test/Makefile.am Thu Sep 22 16:44:54 2011 -0400 @@ -23,9 +23,7 @@ FCN_FILES = \ fntests.m \ test_args.m \ - test_classes.m \ test_contin.m \ - test_ctor_vs_method.m \ test_diag_perm.m \ test_error.m \ test_eval-catch.m \ @@ -53,15 +51,7 @@ test_unwind.m \ test_while.m -include @Blork/module.mk -include @Cork/module.mk -include @Dork/module.mk -include @Gork/module.mk -include @Pork/module.mk -include @Sneetch/module.mk -include @Snork/module.mk -include @Spork/module.mk - +include classes/module.mk include ctor-vs-method/module.mk check: test_sparse.m test_bc_overloads.m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Blork/Blork.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,16 @@ +function [ s ] = Blork( bleek ) +% Test class. + + if (nargin==1) && isa(bleek, 'Blork') + s = bleek; + else + if nargin==0 + s.bleek = 1; + else + s.bleek = bleek; + end + s = class(s, 'Blork'); + + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Blork/bleek.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ out ] = bleek( in, val ) + + if (nargin==1) + out = in.bleek; + else + in.bleek = val; + out = in; + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Blork/display.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,7 @@ +function display( s ) + + disp([inputname(1),'.bleek = ']) + disp(' '); + disp(s.bleek); + +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Blork/get.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ v ] = get( s, propName ) + + switch propName + case 'bleek' + v = s.bleek; + otherwise + error([propName, ' is not a valid Blork property']); + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Blork/set.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,16 @@ +function [ s ] = set( s, varargin ) + + propArgs = varargin; + while (length(propArgs) >= 2) + propName = propArgs{1}; + propValue = propArgs{2}; + propArgs = propArgs(3:end); + switch propName + case 'bleek' + s.bleek = propValue; + otherwise + error([propName, ' is not a valid Blork property']); + end + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Cork/Cork.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,16 @@ +function [ s ] = Cork( click ) +% Test class. + + if ( (nargin==1) && (isa(click, 'Cork')) ) + s = click; + return; + end + + if( nargin<1 ) + s.click = 1; + else + s.click = click; + end + s = class(s, 'Cork'); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Cork/click.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ out ] = click( in, val ) + + if (nargin==1) + out = in.click; + else + in.click = val; + out = in; + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Cork/display.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,7 @@ +function display( s ) + + disp([inputname(1),'.click = ']); + disp(' '); + disp(s.click); + +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Cork/get.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ v ] = get( s, propName ) + + switch propName + case 'click' + v = s.click; + otherwise + error([propName, ' is not a valid Cork property']); + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Cork/set.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,16 @@ +function [ s ] = set( s, varargin ) + + propArgs = varargin; + while (length(propArgs) >= 2) + propName = propArgs{1}; + propValue = propArgs{2}; + propArgs = propArgs(3:end); + switch propName + case 'click' + s.click = propValue; + otherwise + error([propName, ' is not a valid Cork property']); + end + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Dork/Dork.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,18 @@ +function [ s ] = Dork( gick, gack ) + + if (nargin==1) && isa(gick,'Dork') + s = gick; + else + s.gack = 0; + if nargin == 0 + s0 = Snork(); + elseif nargin==1 + s0 = Snork(gick); + else + s0 = Snork(gick); + s.gack = gack; + end + s = class(s,'Dork',s0); + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Dork/bling.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = bling( m1, m2 ) + + out = 1; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Dork/display.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,13 @@ +function display( s ) +% Display the critical info for an amplifier + + gick = get(s,'gick'); + disp([inputname(1),'.gick = ']) + disp(' '); + disp(gick); + disp(' '); + disp([inputname(1),'.gack = ']) + disp(' '); + disp(s.gack); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Dork/gack.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ out ] = gack( in, val ) + + if (nargin==1) + out = in.gack; + else + in.gack = val; + out = in; + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Dork/get.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ v ] = get( s, propName ) + + switch propName + case 'gack' + v = s.gack; + otherwise + v = get(s.Snork,propName); + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Dork/getStash.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = getStash(cls) + + out = myStash(); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Dork/private/myStash.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = myStash() + + out = 2; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Dork/set.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,16 @@ +function [ s ] = set( s, varargin ) + + propArgs = varargin; + while (length(propArgs) >= 2) + propName = propArgs{1}; + propValue = propArgs{2}; + propArgs = propArgs(3:end); + switch propName + case 'gack' + s.gack = propValue; + otherwise + s.Snork = set(s.Snork, propName, propValue); + end + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Gork/Gork.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,15 @@ +function [ s ] = Gork( g ) + if (nargin==1) && isa(g,'Gork') + s = sprk; + return; + end + + drk = Dork(); + prk = Pork(); + blrk = Blork(); + s.Cork = Cork(17); % Aggregation. + s.gark = -2; + s.gyrk = -3; + s = class(s,'Gork',drk,prk,blrk); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Gork/cork.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ out ] = cork( in, val ) + + if (nargin==1) + out = in.Cork; + else + in.Cork = val; + out = in; + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Gork/display.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,16 @@ +function display( s ) +% Display the critical info for a Gork. + + dork_base = s.Dork + %pork_base = s.Pork + %sprk = s.sprk; + gark = get(s,'gark'); + disp([inputname(1),'.gark = ']) + disp(' '); + disp(gark); + disp([inputname(1),'.Cork= ']) + disp(' '); + disp(click(s.Cork)); + + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Gork/gark.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ out ] = gark( in, val ) + + if (nargin==1) + out = in.gark; + else + in.gark = val; + out = in; + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Gork/get.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,14 @@ +function [ v ] = get( s, propName ) + + switch propName + case 'cork' + v = s.Cork; + case 'gark' + v = s.gark; + otherwise + % Note that get/set for multiple parents is hard. We only do one + % branch of the parent tree just to test this stuff out. + v = get(s.Dork,propName); + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Gork/set.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,24 @@ +function [ s ] = set( s, varargin ) + + propArgs = varargin; + while (length(propArgs) >= 2) + propName = propArgs{1}; + propValue = propArgs{2}; + propArgs = propArgs(3:end); + switch propName + case 'cork' + if(isa(propValue,'Cork')) + s.Cork = propValue; + else + s.Cork = set(s.Cork, 'click',propValue); + end + case 'gark' + s.gark = propValue; + otherwise + % Note that get/set for multiple parents is hard. We only do one + % branch of the parent tree just to test this stuff out. + s.Dork = set(s.Dork, propName, propValue); + end + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Gork/subsasgn.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,9 @@ +function g = subsasgn(g, s, x) + + switch s.type + case '.' + switch s.subs + case 'gyrk' + g.gyrk = x; + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Gork/subsref.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,9 @@ +function x = subsref(g, s) + + switch s.type + case '.' + switch s.subs + case 'gyrk' + x = g.gyrk; + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Pork/Pork.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,19 @@ +function [ s ] = Pork( geek, gurk ) + + if (nargin==1) && isa(geek,'Pork') + s = geek; + else + s.gurk = 0; + if nargin == 0 + s0 = Spork(); + elseif nargin==1 + s0 = Spork(geek); + else + s0 = Spork(geek); + s.gurk = gurk; + end + s = class(s,'Pork',s0); + end + superiorto('Dork'); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Pork/bling.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = bling( m1, m2 ) + + out = 2; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Pork/display.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,13 @@ +function display( s ) +% Display the critical info for an amplifier + + geek = get(s,'geek'); + disp([inputname(1),'.geek = ']) + disp(' '); + disp(geek); + disp(' '); + disp([inputname(1),'.gurk = ']) + disp(' '); + disp(s.gurk); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Pork/get.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ v ] = get( s, propName ) + + switch propName + case 'gurk' + v = s.gurk; + otherwise + v = get(s.Spork,propName); + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Pork/gurk.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ out ] = gurk( in, val ) + + if (nargin==1) + out = in.gurk; + else + in.gurk = val; + out = in; + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Pork/private/myStash.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = myStash() + + out = 4; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Pork/set.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,16 @@ +function [ s ] = set( s, varargin ) + + propArgs = varargin; + while (length(propArgs) >= 2) + propName = propArgs{1}; + propValue = propArgs{2}; + propArgs = propArgs(3:end); + switch propName + case 'gurk' + s.gurk = propValue; + otherwise + s.Spork = set(s.Spork, propName, propValue); + end + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Sneetch/Sneetch.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,16 @@ +function [ s ] = Sneetch( mcbean ) +% Test class: should produce error. + + if (nargin==1) && isa(mcbean, 'Sneetch') + s = mcbean; + else + if nargin==0 + s.mcbean = 1; + else + s.mcbean = mcbean; + end + s = class(s, 'Sneetch'); + s.sylvester = 1; + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Sneetch/display.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function display( s ) + + disp([inputname(1),'.mcbean = ']) + disp(' '); + disp(s.mcbean); + disp([inputname(1),'.sylvester = ']) + disp(' '); + disp(s.sylvester); + +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/Snork.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,17 @@ +function [ s ] = Snork( gick ) +% Test class. + + if ( (nargin==1) && (isa(gick, 'Snork')) ) + s = gick; + else + s.cack = [0 1 2 3]; + if nargin==0 + s.gick = 1; + else + s.gick = gick; + end + s = class(s, 'Snork'); + + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/cack.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = cack( in ) + + out = in.cack; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/display.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,7 @@ +function display( s ) + + disp([inputname(1),'.gick = ']); + disp(' '); + disp(s.gick); + +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/end.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,9 @@ +function r = end (snk, index_pos, num_indices) + + if (num_indices ~= 1) + error ('Snork object may only have one index') + end + + r = length (snk.cack); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/get.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ v ] = get( s, propName ) + + switch propName + case 'gick' + v = s.gick; + otherwise + error([propName, ' is not a valid Snork property']); + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/getStash.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = getStash(cls) + + out = myStash(); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/gick.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ out ] = gick( in, val ) + + if (nargin==1) + out = in.gick; + else + in.gick = val; + out = in; + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/loadobj.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,6 @@ +function [ out ] = loadobj( in ) + + out = in; + out.cack = [-1 -2 -3 -4]; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/private/myStash.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = myStash() + + out = 1; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/saveobj.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,6 @@ +function [ out ] = saveobj( in ) + + out = in; + out.cack = []; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/set.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,16 @@ +function [ s ] = set( s, varargin ) + + propArgs = varargin; + while (length(propArgs) >= 2) + propName = propArgs{1}; + propValue = propArgs{2}; + propArgs = propArgs(3:end); + switch propName + case 'gick' + s.gick = propValue; + otherwise + error([propName, ' is not a valid Snork property']); + end + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/subsasgn.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,38 @@ +function snk = subsasgn (snk, s, val) + if (length (s) < 1) + error ('Snork: needs index'); + end + switch (s(1).type) + case '()' + ind = s(1).subs; + if (numel (ind) ~= 1) + error ('Snork: need exactly one index'); + else + if (length (s) == 1) + snk.cack(ind{1}) = val; + else + error ('Snork: chained subscripts not allowed for {}'); + end + end + case '{}' + ind = s(1).subs; + if (numel (ind) ~= 1) + error ('Snork: need exactly one index'); + else + if (length (s) == 1) + snk.cack(ind{1}) = val; + else + error ('Snork: chained subscripts not allowed for {}'); + end + end + case '.' + fld = s(1).subs; + if (strcmp (fld, 'gick')) + snk.gick = val; + else + error ('Snork/subsasgn: invalid property \"%s\"', fld); + end + otherwise + error ('invalid subscript type'); + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/subsindex.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = subsindex( obj ) + + out = 0; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Snork/subsref.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,30 @@ +function b = subsref (snk, s) + if (isempty (s)) + error ('Snork: missing index'); + end + switch (s(1).type) + case '()' + ind = s(1).subs; + if (numel (ind) ~= 1) + error ('Snork: need exactly one index'); + else + b = snk.cack(ind{1}); + end + case '{}' + ind = s(1).subs; + if (numel (ind) ~= 1) + error ('Snork: need exactly one index'); + else + b = snk.cack(ind{1}); + end + case '.' + fld = s.subs; + if (strcmp (fld, 'gick')) + b = snk.gick; + else + error ('Snork/subsref: invalid property \"%s\"', fld); + end + otherwise + error ('invalid subscript type'); + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Spork/Spork.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,17 @@ +function [ s ] = Spork( geek ) +% Test class. + + if (nargin==1) && isa(geek, 'Spork') + s = geek; + else + s.cack = [-1 -2 -3 -4]; + if nargin==0 + s.geek = 1; + else + s.geek = geek; + end + s = class(s, 'Spork'); + + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Spork/cack.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = cack( in ) + + out = in.cack; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Spork/display.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,7 @@ +function display( s ) + + disp([inputname(1),'.geek = ']) + disp(' '); + disp(s.geek); + +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Spork/geek.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ out ] = geek( in, val ) + + if (nargin==1) + out = in.geek; + else + in.geek = val; + out = in; + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Spork/get.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,10 @@ +function [ v ] = get( s, propName ) + + switch propName + case 'geek' + v = s.geek; + otherwise + error([propName, ' is not a valid Spork property']); + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Spork/getStash.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = getStash(cls) + + out = myStash(); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Spork/loadobj.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,8 @@ +function [ out ] = loadobj( in ) + + out = in; + if (~isa(in,'Spork')) + out.cack=[]; + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Spork/private/myStash.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,5 @@ +function [ out ] = myStash() + + out = 3; + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Spork/saveobj.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,6 @@ +function [ out ] = saveobj( in ) + + out = in; + %rmfield(out,'cack'); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/@Spork/set.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,16 @@ +function [ s ] = set( s, varargin ) + + propArgs = varargin; + while (length(propArgs) >= 2) + propName = propArgs{1}; + propValue = propArgs{2}; + propArgs = propArgs(3:end); + switch propName + case 'geek' + s.geek = propValue; + otherwise + error([propName, ' is not a valid Spork property']); + end + end + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/classes/test_classes.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,201 @@ +## Copyright (C) 2009-2011 Robert T. Short +## +## This file is part of Octave. +## +## Octave 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 3 of the License, or (at +## your option) any later version. +## +## Octave 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 Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +%% Test script for legacy OOP. +%% Requires the path to contain the test classes. +%% +%% Note: This script and all classes are also intended to run +%% in MATLAB to test compatibility. Don't break that! +%% +%% To Do: This script tests to ensure that things done correctly work +%% corrrectly. It should also check that things done incorrectly +%% error properly. +%% +%% The classes used for the tests reside in the test directory. +%% +%% The classes provide the ability to test most of the major features +%% of the legacy OOP facilities. There are a number of classes, mostly +%% kind of the same, that create a hierarchy. + +%% Test the Snork class. The Snork class has a number of the standard +%% methods that the others don't so we can test indexing and other +%% features. +%!shared snk, snk1, snk2 +%!test snk = Snork(); +%! assert(gick(snk),1) +%! assert(snk.gick,1) +%! assert(snk(2),1); +%! assert(snk{end},3); +%!test snk = gick(snk,2); +%! assert(gick(snk),2) +%!test snk = set(snk,'gick',7); +%! assert(get(snk, 'gick'), 7) +%!test snk.gick = 4; +%! assert(gick(snk),4) +%! snk(1) = 3; +%!test snk{end} = 9; +%! assert(cack(snk),[3 1 2 9]) +%! assert(getStash(snk),1) % Check private functions. +%! assert(isobject(snk)) +%! assert(class(snk),'Snork') +%! assert(isa(snk,'Snork')) +%! assert(~isa(snk,'Sneetch')) +%! assert(ismethod(snk,'gick')) +%! assert(~ismethod(snk,'bletch')) +%! assert(exist('snk')) +%! assert(~exist('blink')) +%!test snk1 = Snork(snk); +%! assert(class(snk1),'Snork') +%! assert(gick(snk1),4) +%!test snk2 = Snork(-3); +%! assert(class(snk2),'Snork') +%! assert(gick(snk2),-3) +%!test x=[1 2 3 4]; +%! assert(x(snk),1); +%% x=methods('Snork'); % Need to test the methods function. +%% save temp snk; +%% load temp % This load causes a segment fault. +%% assert(cack(snk),[-1 -2 -3 -4]); % This is a major bug! + +%% The Spork class is a near clone of Snork but without as many standard +%% methods. We are testing no new octave features, but this is makes +%% sure that we haven't bollixed up the Spork class if we should make +%% changes. We use Spork in the class hierarchy. +%!shared sprk +%!test sprk = Spork(); +%! assert(geek(sprk),1) +%!test sprk = geek(sprk,3); +%! assert(geek(sprk),3) +%!test sprk = set(sprk,'geek',7); +%! assert(get(sprk, 'geek'), 7) +%! assert(class(sprk),'Spork'); +%! assert(isa(sprk,'Spork')) + +%% The Blork class is a near clone of Snork but without as many standard +%% methods. We are testing no new octave features, but this is makes +%% sure that we haven't bollixed up the Blork class if we should make +%% changes. We use Blork in the class hierarchy. +%!shared blrk +%!test blrk = Blork(); +%! assert(bleek(blrk),1) +%!test blrk = bleek(blrk,3); +%! assert(bleek(blrk),3) +%!test blrk = set(blrk,'bleek',13); +%! assert(get(blrk, 'bleek'), 13) +%! assert(class(blrk),'Blork'); +%! assert(isa(blrk,'Blork')) + +%% The Cork class is a near clone of Snork but without as many standard +%% methods. We are testing no new octave features, but this is makes +%% sure that we haven't bollixed up the Cork class if we should make +%% changes. We use Cork in the class hierarchy. +%!shared crk +%!test crk = Cork(23); +%! assert(click(crk),23) +%!test crk = click(crk,3); +%! assert(click(crk),3) +%!test crk = set(crk,'click',13); +%! assert(get(crk, 'click'), 13) +%! assert(class(crk),'Cork'); +%! assert(isa(crk,'Cork')) + +%% The Dork class tests single inheritance. +%!shared drk +%!test drk = Dork(); +%! assert(gack(drk),0) +%!test drk = gack(drk,-2); +%! assert(gack(drk),-2) +%!test drk = gick(drk,2); +%! assert(gick(drk),2); +%!test drk = set(drk, 'gick',3, 'gack',-3); +%! assert(get(drk, 'gick'), 3) +%! assert(get(drk, 'gack'), -3) +%! assert(class(drk),'Dork') +%! assert(isa(drk,'Dork')) +%! assert(isa(drk,'Snork')) +%! assert(getStash(drk),2) +%!test drk1 = Dork(drk); +%! assert(class(drk1),'Dork') +%! assert(isa(drk1,'Snork')) +%! assert(gick(drk1),3) +%! assert(gack(drk1),-3) +%!test drk2 = Dork(-4,4); +%! assert(class(drk2),'Dork') +%! assert(isa(drk2,'Snork')) +%! assert(gick(drk2),-4) +%! assert(gack(drk2),4) + +%% The Pork class is essentially a clone of Dork. It is used as part +%% of the multiple inheritance test. +%!shared prk, drk +%!test prk = Pork(); +%! assert(geek(prk),1) +%! assert(gurk(prk),0) +%!test prk = gurk(prk,-3); +%! assert(gurk(prk),-3) +%!test prk = geek(prk,9); +%! assert(geek(prk),9) +%! assert(class(prk),'Pork') +%! assert(isa(prk,'Pork')) +%! assert(isa(prk,'Spork')) +%!test drk = Dork(); % Precedence. +%! assert(bling(drk,prk),2) +%! assert(bling(prk,drk),2) + +%% The Gork class tests aggregation and multiple inheritance. +%!shared grk +%!test grk = Gork(); +%! assert(gick(grk),1) +%! assert(geek(grk),1) +%! assert(gack(grk),0) +%! assert(gurk(grk),0) +%! assert(bleek(grk),1) +%! assert(gark(grk),-2) +%! assert(click(cork(grk)),17) +%! assert(class(cork(grk)),'Cork') +%!test grk = gick(grk,3); +%!test grk = geek(grk,4); +%!test grk = gack(grk,-9); +%!test grk = gurk(grk,-8); +%!test grk = bleek(grk,-7); +%!test grk = gark(grk,-6); +%!test grk = cork(grk,click(cork(grk),23)); +%! assert(gick(grk),3) +%! assert(geek(grk),4) +%! assert(gack(grk),-9) +%! assert(gurk(grk),-8) +%! assert(bleek(grk),-7) +%! assert(gark(grk),-6) +%! assert(click(cork(grk)),23) +%!test +%! cork1 = Cork(13); +%! grk = set(grk, 'gick',-5, 'gack',-6, 'gark',-7, 'cork',cork1); +%! assert(get(grk,'gick'),-5) +%! assert(get(grk,'gack'),-6) +%! assert(get(grk,'gark'),-7) +%! assert(click(get(grk, 'cork')),13); +%!test grk = set(grk, 'cork',12); +%! assert(click(get(grk, 'cork')),12); +%! assert(class(cork(grk)),'Cork') +%! assert(class(grk),'Gork') +%! assert(isa(grk,'Gork')) +%! assert(isa(grk,'Dork')) +%! assert(isa(grk,'Pork')) +%! assert(isa(grk,'Blork')) +%! assert(isa(grk,'Snork')) +%! assert(isa(grk,'Spork'))
--- a/test/ctor-vs-method/module.mk Thu Sep 22 16:01:28 2011 -0500 +++ b/test/ctor-vs-method/module.mk Thu Sep 22 16:44:54 2011 -0400 @@ -5,6 +5,7 @@ ctor-vs-method/@other/parent.m \ ctor-vs-method/@parent/method.m \ ctor-vs-method/@parent/parent.m \ - ctor-vs-method/__trace__.m + ctor-vs-method/__trace__.m \ + test_ctor_vs_method.m FCN_FILES += $(ctor_vs_method_FCN_FILES)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/ctor-vs-method/test_ctor_vs_method.m Thu Sep 22 16:44:54 2011 -0400 @@ -0,0 +1,56 @@ +## Copyright (C) 2011 John W. Eaton +## +## This file is part of Octave. +## +## Octave 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 3 of the License, or (at +## your option) any later version. +## +## Octave 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 Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +%% Test script for legacy OOP. +%% Requires the path to contain the directory ctor-vs-method. +%% +%% Note: This script and all classes are also intended to run +%% in Matlab to test compatibility. Don't break that! + +%!shared d, o +%! d = derived (); +%! o = other (); +%! +%!error method (o); + +%!test +%! ctrace = {'begin parent/method'; +%! 'begin derived/parent'; +%! 'begin parent/parent'; +%! 'end parent/parent'; +%! 'end derived/parent'; +%! 'end parent/method'}; +%! __trace__ (); %% clear call trace info +%! method (d); +%! assert (__trace__ (), ctrace); + +%!test +%! ctrace = {'begin other/parent'; +%! 'end other/parent'}; +%! __trace__ (); %% clear call trace info +%! parent (o); +%! assert (__trace__ (), ctrace); + +%!test +%! ctrace = {'begin derived/parent'; +%! 'begin parent/parent'; +%! 'end parent/parent'; +%! 'end derived/parent'}; +%! __trace__ (); %% clear call trace info +%! parent (d); +%! assert (__trace__ (), ctrace);
--- a/test/fntests.m Thu Sep 22 16:01:28 2011 -0500 +++ b/test/fntests.m Thu Sep 22 16:44:54 2011 -0400 @@ -115,26 +115,45 @@ dp = dn = dxf = dsk = 0; for i = 1:length (lst) nm = lst(i).name; - if (length (nm) > 5 && strcmp (nm(1:5), "test_") - && strcmp (nm((end-1):end), ".m")) - p = n = xf = sk = 0; - ffnm = fullfile (d, nm); - if (has_tests (ffnm)) - print_test_file_name (nm); - [p, n, xf, sk] = test (nm(1:(end-2)), "quiet", fid); - print_pass_fail (n, p); - files_with_tests(end+1) = ffnm; - ##elseif (has_demos (ffnm)) - ## files_with_tests(end+1) = ffnm; - else - files_with_no_tests(end+1) = ffnm; - endif + if (lst(i).isdir + && ! strcmp (nm, ".") && ! strcmp (nm, "..") + && ! strcmp (nm, "private") && nm(1) != "@" + && ! strcmp (nm, "CVS")) + [p, n, xf, sk] = run_test_dir (fid, [d, "/", nm]); dp += p; dn += n; dxf += xf; dsk += sk; endif endfor + saved_dir = pwd (); + unwind_protect + chdir (d); + for i = 1:length (lst) + nm = lst(i).name; + if (length (nm) > 5 && strcmp (nm(1:5), "test_") + && strcmp (nm((end-1):end), ".m")) + p = n = xf = sk = 0; + ffnm = fullfile (d, nm); + if (has_tests (ffnm)) + print_test_file_name (nm); + [p, n, xf, sk] = test (nm(1:(end-2)), "quiet", fid); + print_pass_fail (n, p); + files_with_tests(end+1) = ffnm; + ##elseif (has_demos (ffnm)) + ## files_with_tests(end+1) = ffnm; + else + files_with_no_tests(end+1) = ffnm; + endif + dp += p; + dn += n; + dxf += xf; + dsk += sk; + endif + endfor + unwind_protect_cleanup + chdir (saved_dir); + end_unwind_protect endfunction function [dp, dn, dxf, dsk] = run_test_script (fid, d);
--- a/test/test_classes.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +0,0 @@ -## Copyright (C) 2009-2011 Robert T. Short -## -## This file is part of Octave. -## -## Octave 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 3 of the License, or (at -## your option) any later version. -## -## Octave 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 Octave; see the file COPYING. If not, see -## <http://www.gnu.org/licenses/>. - -%% Test script for legacy OOP. -%% Requires the path to contain the test classes. -%% -%% Note: This script and all classes are also intended to run -%% in MATLAB to test compatibility. Don't break that! -%% -%% To Do: This script tests to ensure that things done correctly work -%% corrrectly. It should also check that things done incorrectly -%% error properly. -%% -%% The classes used for the tests reside in the test directory. -%% -%% The classes provide the ability to test most of the major features -%% of the legacy OOP facilities. There are a number of classes, mostly -%% kind of the same, that create a hierarchy. - -%% Test the Snork class. The Snork class has a number of the standard -%% methods that the others don't so we can test indexing and other -%% features. -%!shared snk, snk1, snk2 -%!test snk = Snork(); -%! assert(gick(snk),1) -%! assert(snk.gick,1) -%! assert(snk(2),1); -%! assert(snk{end},3); -%!test snk = gick(snk,2); -%! assert(gick(snk),2) -%!test snk = set(snk,'gick',7); -%! assert(get(snk, 'gick'), 7) -%!test snk.gick = 4; -%! assert(gick(snk),4) -%! snk(1) = 3; -%!test snk{end} = 9; -%! assert(cack(snk),[3 1 2 9]) -%! assert(getStash(snk),1) % Check private functions. -%! assert(isobject(snk)) -%! assert(class(snk),'Snork') -%! assert(isa(snk,'Snork')) -%! assert(~isa(snk,'Sneetch')) -%! assert(ismethod(snk,'gick')) -%! assert(~ismethod(snk,'bletch')) -%! assert(exist('snk')) -%! assert(~exist('blink')) -%!test snk1 = Snork(snk); -%! assert(class(snk1),'Snork') -%! assert(gick(snk1),4) -%!test snk2 = Snork(-3); -%! assert(class(snk2),'Snork') -%! assert(gick(snk2),-3) -%!test x=[1 2 3 4]; -%! assert(x(snk),1); -%% x=methods('Snork'); % Need to test the methods function. -%% save temp snk; -%% load temp % This load causes a segment fault. -%% assert(cack(snk),[-1 -2 -3 -4]); % This is a major bug! - -%% The Spork class is a near clone of Snork but without as many standard -%% methods. We are testing no new octave features, but this is makes -%% sure that we haven't bollixed up the Spork class if we should make -%% changes. We use Spork in the class hierarchy. -%!shared sprk -%!test sprk = Spork(); -%! assert(geek(sprk),1) -%!test sprk = geek(sprk,3); -%! assert(geek(sprk),3) -%!test sprk = set(sprk,'geek',7); -%! assert(get(sprk, 'geek'), 7) -%! assert(class(sprk),'Spork'); -%! assert(isa(sprk,'Spork')) - -%% The Blork class is a near clone of Snork but without as many standard -%% methods. We are testing no new octave features, but this is makes -%% sure that we haven't bollixed up the Blork class if we should make -%% changes. We use Blork in the class hierarchy. -%!shared blrk -%!test blrk = Blork(); -%! assert(bleek(blrk),1) -%!test blrk = bleek(blrk,3); -%! assert(bleek(blrk),3) -%!test blrk = set(blrk,'bleek',13); -%! assert(get(blrk, 'bleek'), 13) -%! assert(class(blrk),'Blork'); -%! assert(isa(blrk,'Blork')) - -%% The Cork class is a near clone of Snork but without as many standard -%% methods. We are testing no new octave features, but this is makes -%% sure that we haven't bollixed up the Cork class if we should make -%% changes. We use Cork in the class hierarchy. -%!shared crk -%!test crk = Cork(23); -%! assert(click(crk),23) -%!test crk = click(crk,3); -%! assert(click(crk),3) -%!test crk = set(crk,'click',13); -%! assert(get(crk, 'click'), 13) -%! assert(class(crk),'Cork'); -%! assert(isa(crk,'Cork')) - -%% The Dork class tests single inheritance. -%!shared drk -%!test drk = Dork(); -%! assert(gack(drk),0) -%!test drk = gack(drk,-2); -%! assert(gack(drk),-2) -%!test drk = gick(drk,2); -%! assert(gick(drk),2); -%!test drk = set(drk, 'gick',3, 'gack',-3); -%! assert(get(drk, 'gick'), 3) -%! assert(get(drk, 'gack'), -3) -%! assert(class(drk),'Dork') -%! assert(isa(drk,'Dork')) -%! assert(isa(drk,'Snork')) -%! assert(getStash(drk),2) -%!test drk1 = Dork(drk); -%! assert(class(drk1),'Dork') -%! assert(isa(drk1,'Snork')) -%! assert(gick(drk1),3) -%! assert(gack(drk1),-3) -%!test drk2 = Dork(-4,4); -%! assert(class(drk2),'Dork') -%! assert(isa(drk2,'Snork')) -%! assert(gick(drk2),-4) -%! assert(gack(drk2),4) - -%% The Pork class is essentially a clone of Dork. It is used as part -%% of the multiple inheritance test. -%!shared prk, drk -%!test prk = Pork(); -%! assert(geek(prk),1) -%! assert(gurk(prk),0) -%!test prk = gurk(prk,-3); -%! assert(gurk(prk),-3) -%!test prk = geek(prk,9); -%! assert(geek(prk),9) -%! assert(class(prk),'Pork') -%! assert(isa(prk,'Pork')) -%! assert(isa(prk,'Spork')) -%!test drk = Dork(); % Precedence. -%! assert(bling(drk,prk),2) -%! assert(bling(prk,drk),2) - -%% The Gork class tests aggregation and multiple inheritance. -%!shared grk -%!test grk = Gork(); -%! assert(gick(grk),1) -%! assert(geek(grk),1) -%! assert(gack(grk),0) -%! assert(gurk(grk),0) -%! assert(bleek(grk),1) -%! assert(gark(grk),-2) -%! assert(click(cork(grk)),17) -%! assert(class(cork(grk)),'Cork') -%!test grk = gick(grk,3); -%!test grk = geek(grk,4); -%!test grk = gack(grk,-9); -%!test grk = gurk(grk,-8); -%!test grk = bleek(grk,-7); -%!test grk = gark(grk,-6); -%!test grk = cork(grk,click(cork(grk),23)); -%! assert(gick(grk),3) -%! assert(geek(grk),4) -%! assert(gack(grk),-9) -%! assert(gurk(grk),-8) -%! assert(bleek(grk),-7) -%! assert(gark(grk),-6) -%! assert(click(cork(grk)),23) -%!test -%! cork1 = Cork(13); -%! grk = set(grk, 'gick',-5, 'gack',-6, 'gark',-7, 'cork',cork1); -%! assert(get(grk,'gick'),-5) -%! assert(get(grk,'gack'),-6) -%! assert(get(grk,'gark'),-7) -%! assert(click(get(grk, 'cork')),13); -%!test grk = set(grk, 'cork',12); -%! assert(click(get(grk, 'cork')),12); -%! assert(class(cork(grk)),'Cork') -%! assert(class(grk),'Gork') -%! assert(isa(grk,'Gork')) -%! assert(isa(grk,'Dork')) -%! assert(isa(grk,'Pork')) -%! assert(isa(grk,'Blork')) -%! assert(isa(grk,'Snork')) -%! assert(isa(grk,'Spork'))
--- a/test/test_ctor_vs_method.m Thu Sep 22 16:01:28 2011 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -## Copyright (C) 2011 John W. Eaton -## -## This file is part of Octave. -## -## Octave 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 3 of the License, or (at -## your option) any later version. -## -## Octave 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 Octave; see the file COPYING. If not, see -## <http://www.gnu.org/licenses/>. - -%% Test script for legacy OOP. -%% Requires the path to contain the directory ctor-vs-method. -%% -%% Note: This script and all classes are also intended to run -%% in Matlab to test compatibility. Don't break that! - -%!shared d, o -%! d = derived (); -%! o = other (); -%! -%!error method (o); - -%!test -%! ctrace = {'begin parent/method'; -%! 'begin derived/parent'; -%! 'begin parent/parent'; -%! 'end parent/parent'; -%! 'end derived/parent'; -%! 'end parent/method'}; -%! __trace__ (); %% clear call trace info -%! method (d); -%! assert (__trace__ (), ctrace); - -%!test -%! ctrace = {'begin other/parent'; -%! 'end other/parent'}; -%! __trace__ (); %% clear call trace info -%! parent (o); -%! assert (__trace__ (), ctrace); - -%!test -%! ctrace = {'begin derived/parent'; -%! 'begin parent/parent'; -%! 'end parent/parent'; -%! 'end derived/parent'}; -%! __trace__ (); %% clear call trace info -%! parent (d); -%! assert (__trace__ (), ctrace);