1function test156
2%TEST156 test assign C=A with typecasting
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7rng ('default') ;
8
9[~, ~, ~, types, ~, ~] = GB_spec_opsall ;
10types = types.all ;
11
12
13for k1 = 1:length(types)
14    in_type = types {k1} ;
15    A = GB_spec_random (5, 5, 0.5, 10, in_type) ;
16    B = GB_spec_random (5, 5, inf, 10, in_type) ;
17
18    for k2 = 1:length(types)
19        out_type = types {k2} ;
20        C = GB_spec_random (5, 5, 0.5, 10, out_type) ;
21        D = GB_spec_random (5, 5, inf, 10, out_type) ;
22
23        % C = A
24        C1 = GB_spec_assign (C, [ ], [ ], A, [ ], [ ], [ ], false) ;
25        C2 = GB_mex_assign  (C, [ ], [ ], A, [ ], [ ], [ ]) ;
26        GB_spec_compare (C1, C2) ;
27
28        % C = B
29        C1 = GB_spec_assign (C, [ ], [ ], B, [ ], [ ], [ ], false) ;
30        C2 = GB_mex_assign  (C, [ ], [ ], B, [ ], [ ], [ ]) ;
31        GB_spec_compare (C1, C2) ;
32
33        % D = A
34        C1 = GB_spec_assign (D, [ ], [ ], A, [ ], [ ], [ ], false) ;
35        C2 = GB_mex_assign  (D, [ ], [ ], A, [ ], [ ], [ ]) ;
36        GB_spec_compare (C1, C2) ;
37
38        % D = B
39        C1 = GB_spec_assign (D, [ ], [ ], B, [ ], [ ], [ ], false) ;
40        C2 = GB_mex_assign  (D, [ ], [ ], B, [ ], [ ], [ ]) ;
41        GB_spec_compare (C1, C2) ;
42
43    end
44end
45
46
47fprintf ('test156: all tests passed\n') ;
48