mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Reorg test fixtures
This commit is contained in:
29
test/fixtures/matlab/matlab_class.m
vendored
Normal file
29
test/fixtures/matlab/matlab_class.m
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
classdef matlab_class
|
||||
properties
|
||||
R;
|
||||
G;
|
||||
B;
|
||||
end
|
||||
methods
|
||||
function obj = matlab_class(r,g,b)
|
||||
obj.R = r;
|
||||
obj.G = g;
|
||||
obj.B = b;
|
||||
end
|
||||
function disp(obj)
|
||||
disp(['Red: ' num2str(obj.R) ...
|
||||
', Green: ' num2str(obj.G) ...
|
||||
', Blue: ' num2str(obj.B)]);
|
||||
end
|
||||
end
|
||||
enumeration
|
||||
red (1,0,0)
|
||||
green (0,1,0)
|
||||
blue (0,0,1)
|
||||
cyan (0,1,1)
|
||||
magenta (1,0,1)
|
||||
yellow (1,1,0)
|
||||
black (0,0,0)
|
||||
white (1,1,1)
|
||||
end
|
||||
end
|
||||
9
test/fixtures/matlab/matlab_function.m
vendored
Normal file
9
test/fixtures/matlab/matlab_function.m
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
function ret = matlab_function(A,B)
|
||||
% Simple function adding two values and displaying the return value
|
||||
|
||||
ret = A+B;
|
||||
% Display the return value
|
||||
disp('Return value in function');
|
||||
disp(ret);
|
||||
|
||||
|
||||
33
test/fixtures/matlab/matlab_function2.m
vendored
Normal file
33
test/fixtures/matlab/matlab_function2.m
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
function ret = matlab_function2(A,B)
|
||||
% Simple function that combines two values using function handles and displays
|
||||
% the return value
|
||||
|
||||
% create function handles
|
||||
fun1=@interface;
|
||||
fun2=@implementation;
|
||||
fun3=@property;
|
||||
fun4=@synthesize;
|
||||
|
||||
% use function handles
|
||||
ret = fun1(A)+fun2(A)+fun3(B)+fun4(B);
|
||||
|
||||
% Display the return value
|
||||
disp('Return value in function');
|
||||
disp(ret);
|
||||
|
||||
|
||||
function A=interface(A)
|
||||
% simple sub-function with same name Objective-C @keyword
|
||||
A=2*A;
|
||||
|
||||
function A=implementation(A)
|
||||
% simple sub-function with same name Objective-C @keyword
|
||||
A=A^2;
|
||||
|
||||
function B=property(B)
|
||||
% simple sub-function with same name Objective-C @keyword
|
||||
B=2*B;
|
||||
|
||||
function B=synthesize(B)
|
||||
% simple sub-function with same name Objective-C @keyword
|
||||
B=B^2;
|
||||
12
test/fixtures/matlab/matlab_script.m
vendored
Normal file
12
test/fixtures/matlab/matlab_script.m
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
% Matlab example script
|
||||
|
||||
%Call matlab_function function which resides in the same directory
|
||||
|
||||
value1 = 5 % semicolon at end of line is not mandatory, only suppresses output to command line.
|
||||
value2 = 3
|
||||
|
||||
% Calculate sum of value1 and value2
|
||||
result = matlab_function(value1,value2);
|
||||
|
||||
disp('called from script')
|
||||
disp(result);
|
||||
13
test/fixtures/matlab/matlab_script2.m
vendored
Normal file
13
test/fixtures/matlab/matlab_script2.m
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
% Matlab example script 2
|
||||
% Comments precended with arbitrary whitespace (spaces or tabs)
|
||||
|
||||
%Call matlab_function function which resides in the same directory
|
||||
|
||||
value1 = 5 % semicolon at end of line is not mandatory, only suppresses output to command line.
|
||||
value2 = 3
|
||||
|
||||
% Calculate sum of value1 and value2
|
||||
result = matlab_function(value1,value2);
|
||||
|
||||
disp('called from script')
|
||||
disp(result);
|
||||
Reference in New Issue
Block a user