Mercurial > hg > octave-nkf
changeset 15959:de240df20290 classdef
Add tests to test_classdef.m
* test/classdef/test_classdef.m: Add tests.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Tue, 15 Jan 2013 21:11:33 -0500 |
parents | 4aedc32e3f4d |
children | 3e782e337f8d |
files | test/classdef/test_classdef.m |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/test/classdef/test_classdef.m +++ b/test/classdef/test_classdef.m @@ -33,11 +33,15 @@ %% of the classdef OOP facilities. There are a number of classes, mostly %% kind of the same, that create a hierarchy. -%% Basic classdef tests -%!shared p, i, amt +%% Basic classdef tests for value class +%!shared p, q, i, amt +%! q = foo_payment (); %! p = foo_payment (4, 4*12, 50e3); %! i = p.rate / (12 * 100); %! amt = (p.principle * i) / (1 - (1 + i)^(-p.term)); +%!assert (isempty (q.rate)); +%!assert (isempty (q.principle)); +%!assert (isempty (q.term)); %!assert (class (p), "foo_payment"); %!assert (p.term, 48); %!assert (p.rate, 4.0); @@ -46,6 +50,8 @@ %!xtest %! assert (amount (p), amt, eps ()) %!xtest -%! xassert (properties (p), {'rate'; 'term'; 'principle'}) +%! assert (properties (p), {'rate'; 'term'; 'principle'}) %!xtest -%! xassert (methods (p), {'amount'; 'foo_payment'}) +%! assert (methods (p), {'amount'; 'foo_payment'}) +%!assert (isempty (foo_payment().rate)) +%!error <property `rate' is not constant> foo_payment.rate