Creating complex stubs

Component Testing for C

If necessary, you can make stub operation more complex by inserting native code into the body of the simulated function. You can do this easily by adding the lines of native code after the prototype, as shown in the following example:

DEFINE STUB file

#int fic_errno;

#char fic_err_msg[100];

#int open_file(char _in f[100])

# { errno = fic_errno; }

#int create_file(char _in f[100])

# { errno = fic_errno; }

#int read_file(int _in fd, char _out l[100])

# { errno = fic_errno; }

#int write_file(int fd, char _in l[100])

# { errno = fic_errno; }

#int close_file(int fd)

# { errno = fic_errno; }

END DEFINE