File: test_char.mw

package info (click to toggle)
mwrap 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,480 kB
  • sloc: cpp: 3,315; python: 1,850; ansic: 856; makefile: 255; lex: 233; sh: 145
file content (23 lines) | stat: -rw-r--r-- 630 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
% test char type, scalars and arrays, in mwrap.
% based on test_single.m, Barnett & Gimbutas 7/5/20-7/20/20.

% make as in Makefile,
% then pass-fail test in octave/matlab with:
% test_char.m

% CHAR======================================================

% scalar char.........

$ void addchar(char a, char b, char *c) { *c = a + b; }
@function c=addchar(a,b)
# addchar(char a, char b, output char[1]c);

% array char........

$ void arraddchar(char *a, char *b, char *c, int n)
$ { for (int i=0;i<n;++i) c[i] = a[i] + b[i]; }
@function c=arraddchar(a,b)
n = numel(a);
# arraddchar(char[n] a, char[n] b, output char[n]c, int n);