source: tests/minmax.cfa@ e1358c0

Last change on this file since e1358c0 was 641707d, checked in by Andrew Beach <ajbeach@…>, 8 months ago

More fixing of warnings. Including another error that slipped through to the build and the rest of the 'easy' fixes on tests not in a directory.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// minmax.cfa --
8//
9// Author : Peter A. Buhr
10// Created On : Wed May 27 17:56:53 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sat Aug 15 08:28:01 2020
13// Update Count : 54
14//
15
16#include <fstream.hfa>
17#include <stdlib.hfa> // min, max
18
19int main( void ) {
20 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmin " | min( 'z', 'a' );
21 sout | "signed int\t\t" | 4 | -3 | "\tmin" | min( 4, -3 );
22 sout | "unsigned int\t\t" | 4u | 3u | "\tmin" | min( 4u, 3u );
23 sout | "signed long int\t\t" | 4l | -3l | "\tmin" | min( 4l, -3l );
24 sout | "unsigned long int\t" | 4ul | 3ul | "\tmin" | min( 4ul, 3ul );
25 sout | "signed long long int\t" | 4ll | -3ll | "\tmin" | min( 4ll, -3ll );
26 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmin" | min( 4ull, 3ull );
27 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmin" | min( 4.0f, 3.1f );
28 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmin" | min( 4.0, 3.1 );
29 sout | "long double\t\t" | 4.0l | 3.1l | "\tmin" | min( 4.0l, 3.1l );
30
31 sout | nl;
32
33 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmax " | max( 'z', 'a' );
34 sout | "signed int\t\t" | 4 | -3 | "\tmax" | max( 4, -3 );
35 sout | "unsigned int\t\t" | 4u | 3u | "\tmax" | max( 4u, 3u );
36 sout | "signed long int\t\t" | 4l | -3l | "\tmax" | max( 4l, -3l );
37 sout | "unsigned long int\t" | 4ul | 3ul | "\tmax" | max( 4ul, 3ul );
38 sout | "signed long long int\t" | 4ll | -3ll | "\tmax" | max( 4ll, -3ll );
39 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmax" | max( 4ull, 3ull );
40 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmax" | max( 4.0f, 3.1f );
41 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmax" | max( 4.0, 3.1 );
42 sout | "long double\t\t" | 4.0l | 3.1l | "\tmax" | max( 4.0l, 3.1l );
43
44 sout | nl;
45
46 sout | "3 arguments";
47 sout | 2 | 3 | 4 | "\tmin" | min(2, 3, 4) | "\tmax" | max(2, 3, 4);
48 sout | 4 | 2 | 3 | "\tmin" | min(4, 2, 3) | "\tmax" | max(4, 2, 3);
49 sout | 3 | 4 | 2 | "\tmin" | min(3, 4, 2) | "\tmax" | max(3, 4, 2);
50
51 sout | "4 arguments";
52 sout | 3 | 2 | 5 | 4 | "\tmin" | min(3, 2, 5, 4) | "\tmax" | max(3, 2, 5, 4);
53 sout | 5 | 3 | 4 | 2 | "\tmin" | min(5, 3, 4, 2) | "\tmax" | max(5, 3, 4, 2);
54} // main
55
56// Local Variables: //
57// tab-width: 4 //
58// compile-command: "cfa minmax.cfa" //
59// End: //
Note: See TracBrowser for help on using the repository browser.