Snoke
shared.h File Reference

shared functions for testing More...

#include <gtest/gtest.h>
#include "Common/common.h"
Include dependency graph for shared.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int changeStream (FILE *file)
 redirects stdout to a file More...
 
void returnStream (FILE *file, int oldstdOut)
 returns stdout back More...
 
bool executeTest (FILE *expectedData, FILE *outputData)
 compare files of expected and actual output and decide if test passes More...
 

Variables

constexpr bool TRAVIS = 0
 

Detailed Description

shared functions for testing

Author
Yegor Ignatov
Version
0.1
Date
2019-05-10

Definition in file shared.h.

Function Documentation

int changeStream ( FILE *  file)

redirects stdout to a file

Parameters
file- desired file to output to
Returns
- value of the old File descriptor

Definition at line 25 of file shared.h.

bool executeTest ( FILE *  expectedData,
FILE *  outputData 
)

compare files of expected and actual output and decide if test passes

Parameters
expectedData- file with expected output for the test case
outputData- file with actual program output
Returns
- mark of whether the files are identical

Definition at line 50 of file shared.h.

void returnStream ( FILE *  file,
int  oldstdOut 
)

returns stdout back

Parameters
file- file, where stdout is redirected
oldstdOut- the fd of old stdout

Definition at line 38 of file shared.h.

Variable Documentation

constexpr bool TRAVIS = 0

Definition at line 17 of file shared.h.