comparison test/classes/@CPrecedenceTester2/CPrecedenceTester2.m @ 16070:e603ce23f20c

Fix and improve functions related to class precedence (bug #38290) * libinterp/octave-value/ov-class.cc(inferiorto): Use only one call to set_class_relationship() and properly use the returned value. Rewrite for clarity (fewer braces, shorter lines). (superiorto): Rewrite similarly to inferiorto() for clarity. * libinterp/interpfcn/symtab.cc(symbol_table::set_class_relationship): Reduce code redundancy using a call to is_superiorto(). Add a comment to make it clear that a new entry in the precedence table is created if sup_class is not already there. (symbol_table::is_superiorto): Rewrite more concisely. Add a comment. * test/classes/@CPrecedenceTester1, test/classes/@CPrecedenceTester2, test/classes/@CPrecedenceTester3: New classes for precedence tests. * test/classes/@Snork/tattack.m: New method for precedence tests. * test/classes/classes.tst: Add precedence tests.
author Julien Bect <julien.bect@supelec.fr>
date Tue, 29 Jan 2013 17:55:53 +0100
parents
children b1283d4c06c2
comparison
equal deleted inserted replaced
16035:999f8257313b 16070:e603ce23f20c
1 function x = CPrecedenceTester2(flag)
2
3 x = struct('useless_data', pi^2);
4 x = class(x, 'CPrecedenceTester2');
5
6 switch flag,
7 case 1, % CPrecedencetester2 > Snork
8 superiorto('Snork');
9 case 2, % CPrecedencetester2 < Snork
10 inferiorto('Snork');
11 otherwise,
12 error('Incorrect value for argument flag: %d', flag);
13 end
14
15 end