Please send questions to
st10@humboldt.edu .
/*--------------------------------------------------
last modified by st10 on 12-9-10
--------------------------------------------------*/
#include <iostream>
#include <cmath>
#include "string_node.h"
using namespace std;
/*--------------------------------------------------
Signature: string_node_test : void -> bool
Purpose: expects nothing, and produces whether string_node's selectors
and modifiers and constructors
return what is expected for example string_nodes
Examples: string_node_test() == true
--------------------------------------------------*/
bool string_node_test()
{
bool constructor_results;
bool modifier_results;
// part of testing constructors: USE each, then see if
// their fields are as expected
// (also testing selectors along the way)
string_node node1("look at me");
string_node node2;
constructor_results = ((node1.get_value() == "look at me") &&
(node1.get_next() == NULL) &&
(node2.get_value() == "") &&
(node2.get_next() == NULL));
// test modifiers
node2.set_value("no longer empty");
node2.set_next(&node1);
modifier_results = (node2.get_value() == "no longer empty") &&
(node2.get_next() == &node1);
return constructor_results && modifier_results;
}