Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/vczip/tests/tvctranspose.c
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 2003-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Phong Vo <[email protected]> *
18
* Glenn Fowler <[email protected]> *
19
* *
20
***********************************************************************/
21
#include "vctest.h"
22
23
#define NCOLS 1600
24
#define NROWS 2000
25
26
int main()
27
{
28
int i, j;
29
Vcchar_t matrix[NROWS][NCOLS], trans[NCOLS][NROWS], *tr;
30
Vcodex_t *vc;
31
32
for(i = 0; i < NROWS; ++i)
33
for(j = 0; j < NCOLS; ++j)
34
{ matrix[i][j] = 'a' + (i+j)%26;
35
trans[j][i] = 'a' + (i+j)%26;
36
}
37
38
if(!(vc = vcopen(0, Vctranspose, "0", 0, VC_ENCODE)) )
39
terror("Cannot open Vctranspose handle");
40
41
vcsetmtarg(vc, "columns", (Void_t*)1600, 2);
42
if((i = vcapply(vc, matrix, sizeof(matrix), &tr)) != sizeof(matrix) )
43
terror("Vctranspose failed");
44
45
if(memcmp(&trans[0][0], tr, sizeof(trans)) != 0)
46
terror("Bad data");
47
48
exit(0);
49
}
50
51