Fawkes API  Fawkes Development Version
CLIPSTest Class Reference

Base class for unit testing with CLIPS. More...

#include <clips_test.h>

Inheritance diagram for CLIPSTest:

Protected Member Functions

virtual void LoadCLIPSFiles (std::vector< std::string > files)
 Load the vector of CLIPS files into the environment. More...
 
bool has_fact (const std::string &fact_set_template, const std::string &query="TRUE")
 Check if a non-ordered fact exists. More...
 
bool has_ordered_fact (const std::string &fact_name, const std::vector< CLIPS::Value > slot_values={})
 Check if an ordered fact exists. More...
 

Protected Attributes

CLIPS::Environment env
 The default CLIPS environment used to run tests. More...
 

Detailed Description

Base class for unit testing with CLIPS.

To define your own test setup, derive from this class.

See also
SimpleCLIPSTest

Definition at line 34 of file clips_test.h.

Member Function Documentation

◆ has_fact()

bool CLIPSTest::has_fact ( const std::string &  fact_set_template,
const std::string &  query = "TRUE" 
)
inlineprotected

Check if a non-ordered fact exists.

This expects the same arguments as CLIPS' any-factp.

Parameters
fact_set_templateThe fact set template of the query, e.g., "((?a action ?p parameters))".
queryThe constraints that must be satisfied by the fact set, e.g., "(eq ?a:param-values ?p:values)".
Returns
true iff the fact exists.

Definition at line 59 of file clips_test.h.

References env.

◆ has_ordered_fact()

bool CLIPSTest::has_ordered_fact ( const std::string &  fact_name,
const std::vector< CLIPS::Value >  slot_values = {} 
)
inlineprotected

Check if an ordered fact exists.

Parameters
fact_nameThe name of the fact, e.g., "foo".
slot_valuesA vector of slot values, e.g., '{ "bar" }'.
Returns
true iff the specified ordered fact exists.

Definition at line 70 of file clips_test.h.

◆ LoadCLIPSFiles()

virtual void CLIPSTest::LoadCLIPSFiles ( std::vector< std::string >  files)
inlineprotectedvirtual

Load the vector of CLIPS files into the environment.

Parameters
filesA vector of paths relative to the current directory.

Definition at line 42 of file clips_test.h.

References env.

Member Data Documentation

◆ env

CLIPS::Environment CLIPSTest::env
protected

The default CLIPS environment used to run tests.

Definition at line 38 of file clips_test.h.

Referenced by has_fact(), and LoadCLIPSFiles().


The documentation for this class was generated from the following file: