source: src/tests/div.c @ e195093

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since e195093 was 08d14cf, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

update math test for new "div" operation

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[08d14cf]1//                               -*- Mode: C -*-
2//
3// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
4//
5// The contents of this file are covered under the licence agreement in the
6// file "LICENCE" distributed with Cforall.
7//
8// div.c --
9//
10// Author           : Peter A. Buhr
11// Created On       : Tue Aug  8 16:28:43 2017
12// Last Modified By : Peter A. Buhr
13// Last Modified On : Tue Aug  8 18:02:44 2017
14// Update Count     : 14
15//
16
17#include <fstream>
18#include <stdlib>                                                                               // div
19
20struct T { int i; };
21T ?/?( T t1, T t2 ) { return t1.i / t2.i; }
22T ?%?( T t1, T t2 ) { return t1.i % t2.i; }
23ofstream * ?|?( ofstream * os, T t ) { return os | t.i; }
24
25int main( void ) {
26        sout | "div" | div( 13, 5 ) | div( 13L, 5L ) | div( 13LL, 5LL ) | endl;
27        short s1 = 13, s2 = 5;
28        sout | "div" | div( s1, s2 ) | endl;
29        T t1 = { 13 }, t2 = { 5 };
30        [t1, t2] = div( t1, t2 );                                                       // polymorphic div
31        sout | "div" | t1 | t2 | endl;
32//      sout | "div" | div( t1, t2 ) | endl;
33} // main
34
35// Local Variables: //
36// tab-width: 4 //
37// compile-command: "cfa div.c" //
38// End: //
Note: See TracBrowser for help on using the repository browser.