1function gbtest60
2%GBTEST60 test GrB.issigned
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: GPL-3.0-or-later
6
7% 8 signed types:
8signed_types   = { 'double', 'single', ...
9    'int8', 'int16', 'int32', 'int64', ...
10    'single complex', 'double complex' } ;
11
12% 5 unsigned types:
13unsigned_types = { 'logical', 'uint8', 'uint16', 'uint32', 'uint64' } ;
14
15for k = 1:length (signed_types)
16    type = signed_types {k} ;
17    assert (GrB.issigned (type)) ;
18    G = GrB (1, type) ;
19    assert (GrB.issigned (G)) ;
20    if (isequal (type, 'single complex'))
21        A = complex (single (pi)) ;
22    elseif (isequal (type, 'double complex'))
23        A = complex (double (pi)) ;
24    else
25        A = cast (pi, type) ;
26    end
27    assert (GrB.issigned (A)) ;
28end
29
30for k = 1:length (unsigned_types)
31    type = unsigned_types {k} ;
32    assert (~GrB.issigned (type)) ;
33    G = GrB (1, type) ;
34    assert (~GrB.issigned (G)) ;
35    A = cast (1, type) ;
36    assert (~GrB.issigned (A)) ;
37end
38
39fprintf ('gbtest60: all tests passed\n') ;
40
41