Wizard
Software Engineering Project - Wizard
Loading...
Searching...
No Matches
gen_gtest_pred_impl Namespace Reference

Functions

 HeaderPreamble (n)
 
 Arity (n)
 
 Title (word)
 
 OneTo (n)
 
 Iter (n, format, sep='')
 
 ImplementationForArity (n)
 
 HeaderPostamble ()
 
 GenerateFile (path, content)
 
 GenerateHeader (n)
 
 UnitTestPreamble ()
 
 TestsForArity (n)
 
 UnitTestPostamble ()
 
 GenerateUnitTest (n)
 
 _Main ()
 

Variables

 SCRIPT_DIR = os.path.dirname(sys.argv[0])
 
 HEADER = os.path.join(SCRIPT_DIR, '../include/gtest/gtest_pred_impl.h')
 
 UNIT_TEST = os.path.join(SCRIPT_DIR, '../test/gtest_pred_impl_unittest.cc')
 

Detailed Description

gen_gtest_pred_impl.py v0.1

Generates the implementation of Google Test predicate assertions and
accompanying tests.

Usage:

  gen_gtest_pred_impl.py MAX_ARITY

where MAX_ARITY is a positive integer.

The command generates the implementation of up-to MAX_ARITY-ary
predicate assertions, and writes it to file gtest_pred_impl.h in the
directory where the script is.  It also generates the accompanying
unit test in file gtest_pred_impl_unittest.cc.

Function Documentation

◆ _Main()

gen_gtest_pred_impl._Main ( )
protected
The entry point of the script.  Generates the header file and its
unit test.

◆ Arity()

gen_gtest_pred_impl.Arity ( n)
Returns the English name of the given arity.

◆ GenerateFile()

gen_gtest_pred_impl.GenerateFile ( path,
content )
Given a file path and a content string
   overwrites it with the given content.

◆ GenerateHeader()

gen_gtest_pred_impl.GenerateHeader ( n)
Given the maximum arity n, updates the header file that implements
the predicate assertions.

◆ GenerateUnitTest()

gen_gtest_pred_impl.GenerateUnitTest ( n)
Returns the tests for up-to n-ary predicate assertions.

◆ HeaderPostamble()

gen_gtest_pred_impl.HeaderPostamble ( )
Returns the postamble for the header file.

◆ HeaderPreamble()

gen_gtest_pred_impl.HeaderPreamble ( n)
Returns the preamble for the header file.

Args:
  n:  the maximum arity of the predicate macros to be generated.

◆ ImplementationForArity()

gen_gtest_pred_impl.ImplementationForArity ( n)
Returns the implementation of n-ary predicate assertions.

◆ Iter()

gen_gtest_pred_impl.Iter ( n,
format,
sep = '' )
Given a positive integer n, a format string that contains 0 or
more '%s' format specs, and optionally a separator string, returns
the join of n strings, each formatted with the format string on an
iterator ranged from 1 to n.

Example:

Iter(3, 'v%s', sep=', ') returns 'v1, v2, v3'.

◆ OneTo()

gen_gtest_pred_impl.OneTo ( n)
Returns the list [1, 2, 3, ..., n].

◆ TestsForArity()

gen_gtest_pred_impl.TestsForArity ( n)
Returns the tests for n-ary predicate assertions.

◆ Title()

gen_gtest_pred_impl.Title ( word)
Returns the given word in title case.  The difference between
this and string's title() method is that Title('4-ary') is '4-ary'
while '4-ary'.title() is '4-Ary'.

◆ UnitTestPostamble()

gen_gtest_pred_impl.UnitTestPostamble ( )
Returns the postamble for the tests.

◆ UnitTestPreamble()

gen_gtest_pred_impl.UnitTestPreamble ( )
Returns the preamble for the unit test file.