Test External Functions Outside of HyperWorks

You can run an external function at the command line to verify that the function works properly.

  1. Create a file that contains sample input and redirect that to your executable.
    For example:
    Bar.exe < mySample.dat

    where mySample.dat contains the following:

    3

    0

    0

    10

    1 2 3 4 5 6 7 8 9 10

    0

    1

    1

    0

    1

    1

    Line 1 indicates the number of vectors being passed to the program, in this case 3.

    Line 2 indicates the number of strings being passed to the program, in this case 0.

    Line 4 tells that program that the next group of data is a vector (a "0" indicates vector and a "3" indicates a string).

    Now that the program is expecting to receive a vector, line 5 indicates that the vector will have 10 members.

    Line 6 contains the 10 members that define the vector.

    Line 7 indicates that the next data set is also a vector ("0" = vector).

    Line 8 indicates that the vector has only 1 member and line 9 is the value of that member.

    Lines 10, 11, and 12 indicate another vector of length 1 with the only member having a value of 1.

    The output of your program should be a result set that makes sense, given the purpose of your external function.

    In this example, Bar.exe < mySample.dat, where mySample.dat contains the following:

    Put Vector:
    • 0.00000000 0.00000000 1.00000000 1.00000000
    • 1.00000000 2.00000000 2.00000000 2.00000000
    • 3.00000000 3.00000000 3.00000000 4.00000000
    • 4.00000000 4.00000000 5.00000000 5.00000000
    • 5.00000000 6.00000000 6.00000000 6.00000000
    • 7.00000000 7.00000000 7.00000000 8.00000000
    • 8.00000000 8.00000000 9.00000000 9.00000000
    • 9.00000000 10.00000000 10.00000000
  2. To check the sample data file, from a command line, type:
    driver test_file