def test_using_other_chapel_code():
    """
    ensures that the definition of a function which uses a module containing a
    function named "foo" will not cause the definition of a extern function by
    the same name.
    """
    out = testcase.runpy(os.path.realpath(__file__))
    assert out.endswith('6\n14 14 3 14 14\n14 14 3 14 14\n(contents = 3.0)\n(contents = 3.0)\n2\n')
示例#2
0
def test_sfile():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created. The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run) But that means
    # we can't use ==
    assert out.endswith('Hi Caller, I am Chapel, pleased to meet you.\n')
def test_using_other_chapel_code():
    """
    ensures that a sfile definition of a Chapel function with a use statement
    will work when the module being used lives in a directory specified with
    the decorator argument "module_dirs"
    """
    out = testcase.runpy(os.path.realpath(__file__))
    assert out.endswith('6\n14 14 3 14 14\n14 14 3 14 14\n(contents = 3.0)\n(contents = 3.0)\n')
def test_example():
    filename = os.sep.join([
        os.path.dirname(os.path.realpath(__file__)), "aux", "GBPUSD1m.txt"
    ])
    out = testcase.runpy(
        os.path.realpath(__file__) + ' --filename %s --no-viz' % filename
    )
    assert out.endswith('171.26344695\n')
示例#5
0
def test_bfile():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created. The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run) But that means
    # we can't use ==
    assert out.endswith('Hello, from a bfile.\n')
def test_return_array_reals():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created. The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run) But that means
    # we can't use ==
    assert out.endswith("2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0\n");
示例#7
0
def test_example():
    filename = os.sep.join(
        [os.path.dirname(os.path.realpath(__file__)), "aux", "GBPUSD1m.txt"])
    out = testcase.runpy(
        os.path.realpath(__file__) + ' --filename %s --no-viz' % filename)
    # Verifies that we get the expected error message when we are passed a
    # numpy array that is not densely packed
    assert 'warning: pyChapel may not support unusually strided ndarrays\n' in out
def test_example52():
    out = testcase.runpy(os.path.realpath(__file__) + ' --tsteps 52 --particles 50000000')
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created. The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run) But that means
    # we can't use ==
    assert out.endswith('Phenomenon after 52 tsteps = 50000000.\n')
def test_example():
    filename = os.sep.join([
        os.path.dirname(os.path.realpath(__file__)), "aux", "GBPUSD1m.txt"
    ])
    out = testcase.runpy(
        os.path.realpath(__file__) + ' --filename %s --no-viz' % filename
    )
    assert out.endswith('171.26344695\n')
def test_modify_array_argument_reals():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created. The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run) But that means
    # we can't use ==
    assert out.endswith("[ 2.  3.  4.  5.  6.  7.  8.  9. 10. 11.]\n")
def test_using_other_chapel_code():
    """
    ensures that an inline definition of a Chapel function with a use statement
    will work when the module being used lives in a directory specified with
    the decorator argument "module_dirs"
    """
    out = testcase.runpy(os.path.realpath(__file__))
    assert out.endswith('6\n14 14 3 14 14\n14 14 3 14 14\n(num = 4, contents = 3.0)\n(num = 4, contents = 3.0)\n')
def test_using_other_chapel_code():
    """
    ensures that the definition of a function which uses a module containing a
    function named "foo" will not cause the definition of a extern function by
    the same name.
    """
    out = testcase.runpy(os.path.realpath(__file__))
    assert out.endswith('6\n14 14 3 14 14\n14 14 3 14 14\n(contents = 3.0)\n(contents = 3.0)\n2\n')
示例#13
0
def test_modify_local_array_copy_reals():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created. The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run) But that means
    # we can't use ==
    assert out.endswith("2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0\n")
示例#14
0
def test_materialization_A():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created.  The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run)  But that means
    # we can't use ==

    # ensure contains both outputs in the correct order
    assert "I'm file 1!\nI'm file 2!\n" in out
def test_example():
    filename = os.sep.join([
        os.path.dirname(os.path.realpath(__file__)), "aux", "GBPUSD1m.txt"
    ])
    out = testcase.runpy(
        os.path.realpath(__file__) + ' --filename %s --no-viz' % filename
    )
    # Verifies that we get the expected error message when we are passed a
    # numpy array that is not densely packed
    assert 'warning: pyChapel may not support unusually strided ndarrays\n' in out
def test_materialization_B():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created.  The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run)  But that means
    # we can't use ==

    # ensure contains both outputs in the correct order
    assert "I'm file 2!\nI'm file 1!\n" in out
示例#17
0
def test_sync():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created.  The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run)  But that means
    # we can't use out.startswith

    # ensure starts and ends with correct statements
    startLoc = out.find('Starting!\n')
    assert startLoc >= 0
    # ensure contains all of the remainder
    for i in xrange(1, 6):
        lineLoc = out.find('#' + str(i) + ' line.\n')
        assert lineLoc >= 0
        assert lineLoc >= startLoc
    assert out.endswith('DONE!\n')
示例#18
0
def test_cobegin():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created.  The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run)  But that means
    # we can't use out.startswith

    # ensure starts and ends with correct statements
    startLoc = out.find('Starting!\n')
    assert startLoc >= 0
    # ensure contains all of the remainder
    for i in range(1, 6):
        lineLoc = out.find('#' + str(i) + ' line.\n')
        assert lineLoc >= 0
        assert lineLoc >= startLoc
    assert out.endswith('DONE!\n')
示例#19
0
def test_begin():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created.  The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run)  But that means
    # we can't use out.startswith

    # ensure starts and ends with correct statements
    startLoc = out.find("Starting!\n")
    assert startLoc >= 0
    # While we can't ensure that all of the first function's output has occurred
    # before the second function begins, we can ensure that their starting
    # output is in order
    secondStart = out.find("Starting part2!\n")
    assert secondStart > startLoc
    # ensure contains all of the remainder
    for i in range(1, 11):
        lineLoc = out.find("#" + str(i) + " line.\n")
        assert lineLoc >= 0
        assert lineLoc >= startLoc
        if i > 5:
            assert lineLoc > secondStart
示例#20
0
def test_begin():
    out = testcase.runpy(os.path.realpath(__file__))
    # The first time this test is run, it may contain output notifying that
    # a temporary file has been created.  The important part is that this
    # expected output follows it (enabling the test to work for all runs, as
    # the temporary file message won't occur in the second run)  But that means
    # we can't use out.startswith

    # ensure starts and ends with correct statements
    startLoc = out.find('Starting!\n')
    assert startLoc >= 0
    # While we can't ensure that all of the first function's output has occurred
    # before the second function begins, we can ensure that their starting
    # output is in order
    secondStart = out.find('Starting part2!\n')
    assert secondStart > startLoc
    # ensure contains all of the remainder
    for i in range(1, 11):
        lineLoc = out.find('#' + str(i) + ' line.\n')
        assert lineLoc >= 0
        assert lineLoc >= startLoc
        if (i > 5):
            assert lineLoc > secondStart
示例#21
0
def test_for():
    output = testcase.runpy(os.path.realpath(__file__));
    for i in range(1, 1001):
        assert 'This is ' + str(i) + '\n' in output
def test_unusual_sfile_loc():
    out = testcase.runpy(os.path.realpath(__file__))
    assert 'Hello from mymodule\n' in out
    assert out.endswith('Hello from inline.\n')
def test_using_multiple_modules():
    out = testcase.runpy(os.path.realpath(__file__))
    # Ensure that when a used module is nowhere near the exported function, we
    # get an error message to that effect.
    assert "error: Cannot find module or enum" in out
示例#24
0
def test_using_multiple_modules():
    out = testcase.runpy(os.path.realpath(__file__))
    # Ensure that when a used module is nowhere near the exported function, we
    # get an error message to that effect.
    assert "error: Cannot find module or enum" in out
示例#25
0
def test_sfile():
    out = testcase.runpy(os.path.realpath(__file__))
    assert out.endswith('Hi Caller, I am Chapel, pleased to meet you.\n')
示例#26
0
def test_unusual_sfile_loc():
    out = testcase.runpy(os.path.realpath(__file__))
    assert 'Hello from mymodule\n' in out
    assert out.endswith('Hello from inline.\n')
示例#27
0
def test_forall():
    output = testcase.runpy(os.path.realpath(__file__))
    for i in xrange(1, 10001):
        assert "This is " + str(i) + "\n" in output
示例#28
0
def test_for():
    output = testcase.runpy(os.path.realpath(__file__));
    for i in xrange(1, 1001):
        assert 'This is ' + str(i) + '\n' in output
示例#29
0
def test_sfile():
    out = testcase.runpy(os.path.realpath(__file__))
    assert out.endswith('Hi Caller, I am Chapel, pleased to meet you.\n')