File: shape.cpp

package info (click to toggle)
blitz%2B%2B 1%3A1.0.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,568 kB
  • sloc: cpp: 57,803; python: 1,941; fortran: 1,510; f90: 852; makefile: 833; sh: 321
file content (57 lines) | stat: -rw-r--r-- 1,301 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Intended coverage: blitz/arrayshape.h
 */

#include "testsuite.h"

#include <blitz/array.h>
#include <blitz/tinyvec2.h>

using namespace blitz;

int main()
{
    TinyVector<int,1> a1(1);
    BZTEST(all(a1 == shape(1)));

    TinyVector<int,2> a2;
    a2 = 5, 10;
    BZTEST(all(a2 == shape(5,10)));

    TinyVector<int,3> a3;
    a3 = 1, 2, 3;
    BZTEST(sum(a3 == shape(1,2,3)) == 3);

    TinyVector<int,4> a4;
    a4 = 1, 2, 3, 4;
    BZTEST(sum(a4 == shape(1,2,3,4)) == 4);

    TinyVector<int,5> a5;
    a5 = 1, 2, 3, 4, 5;
    BZTEST(count(a5 == shape(1,2,3,4,5)) == 5);

    TinyVector<int,6> a6;
    a6 = 1, 2, 3, 4, 5, 6;
    BZTEST(count(a6 == shape(1,2,3,4,5,6)) == 6);

    TinyVector<int,7> a7;
    a7 = 1, 2, 3 ,4, 5, 6, 7;
    BZTEST(count(a7 == shape(1,2,3,4,5,6,7)) == 7);

    TinyVector<int,8> a8;
    a8 = 1, 2, 3, 4, 5, 6, 7, 8;
    BZTEST(count(a8 == shape(1,2,3,4,5,6,7,8)) == 8);

    TinyVector<int,9> a9;
    a9 = 1, 2, 3, 4, 5, 6, 7, 8, 9;
    BZTEST(count(a9 == shape(1,2,3,4,5,6,7,8,9)) == 9);

    TinyVector<int,10> a10;
    a10 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
    BZTEST(count(a10 == shape(1,2,3,4,5,6,7,8,9,10)) == 10);

    TinyVector<int,11> a11;
    a11 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11;
    BZTEST(count(a11 == shape(1,2,3,4,5,6,7,8,9,10,11)) == 11);
}