Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /tests/rtest/tests/int-arith/int-arith.diderot
ViewVC logotype

View of /tests/rtest/tests/int-arith/int-arith.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5306 - (download) (annotate)
Tue Aug 15 03:04:14 2017 UTC (19 months ago) by jhr
File size: 969 byte(s)
added regression test
#version 2

/* real-arith.diderot
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2017 The University of Chicago
 * All rights reserved.
 */

/* test various arithmetic operations on reals; these tests are to
 * verify that the code generator is producing basically correct
 */

int[] data = { -12, -1, 0, 2, 42 };

initialize {
  // +, -, *, /, fmod, min, max
    print (data[0], " + ", data[3], " = ", data[0]+data[3], "\n");
    print (data[0], " - ", data[3], " = ", data[0]-data[3], "\n");
    print (data[0], " * ", data[3], " = ", data[0]*data[3], "\n");
    print (data[4], " / ", data[0], " = ", data[4]/data[0], "\n");
    print (data[4], " % ", data[0], " = ", data[4]%data[0], "\n");

  // test integral operators
    foreach (int x in data) {
	print ("abs(", x, ") = ", |x|, "\n");
    }
}

strand S () {

  output int out = 0;

  update { stabilize; }

}

create_collection { S() | i in 1..1 }

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0