src/core/test/config-test-suite.cc
author Tom Henderson <tomh@tomh.org>
Sun, 22 May 2011 22:28:15 -0700
changeset 7252 c8200621e252
parent 7169 358f71a624d8
child 7784 549a235e73a1
permissions -rw-r--r--
rerun check-style.py with uncrustify-0.58
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     2
/*
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     3
 * Copyright (c) 2008 INRIA
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     4
 *
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     8
 *
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    12
 * GNU General Public License for more details.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    13
 *
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    17
 *
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    18
 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    19
 */
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    20
#include "ns3/config.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    21
#include "ns3/test.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    22
#include "ns3/integer.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    23
#include "ns3/traced-value.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    24
#include "ns3/trace-source-accessor.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    25
#include "ns3/callback.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    26
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    27
#include "ns3/singleton.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    28
#include "ns3/object.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    29
#include "ns3/object-vector.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    30
#include "ns3/names.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    31
#include "ns3/pointer.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    32
#include "ns3/log.h"
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    33
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    34
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    35
#include <sstream>
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    36
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    37
namespace ns3 {
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    38
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    39
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    40
// An object with some attributes that we can play with using config.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    41
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    42
class ConfigTestObject : public Object
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    43
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    44
public:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    45
  static TypeId GetTypeId (void);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    46
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    47
  void AddNodeA (Ptr<ConfigTestObject> a);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    48
  void AddNodeB (Ptr<ConfigTestObject> b);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    49
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    50
  void SetNodeA (Ptr<ConfigTestObject> a);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    51
  void SetNodeB (Ptr<ConfigTestObject> b);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    52
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    53
  int8_t GetA (void) const;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    54
  int8_t GetB (void) const;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    55
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    56
private:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    57
  std::vector<Ptr<ConfigTestObject> > m_nodesA;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    58
  std::vector<Ptr<ConfigTestObject> > m_nodesB;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    59
  Ptr<ConfigTestObject> m_nodeA;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    60
  Ptr<ConfigTestObject> m_nodeB;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    61
  int8_t m_a;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    62
  int8_t m_b;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    63
  TracedValue<int16_t> m_trace;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    64
};
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    65
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    66
TypeId
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    67
ConfigTestObject::GetTypeId (void)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    68
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    69
  static TypeId tid = TypeId ("ConfigTestObject")
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    70
    .SetParent<Object> ()
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    71
    .AddAttribute ("NodesA", "",
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    72
                   ObjectVectorValue (),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    73
                   MakeObjectVectorAccessor (&ConfigTestObject::m_nodesA),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    74
                   MakeObjectVectorChecker<ConfigTestObject> ())
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    75
    .AddAttribute ("NodesB", "",
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    76
                   ObjectVectorValue (),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    77
                   MakeObjectVectorAccessor (&ConfigTestObject::m_nodesB),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    78
                   MakeObjectVectorChecker<ConfigTestObject> ())
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    79
    .AddAttribute ("NodeA", "",
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    80
                   PointerValue (),
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    81
                   MakePointerAccessor (&ConfigTestObject::m_nodeA),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    82
                   MakePointerChecker<ConfigTestObject> ())
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    83
    .AddAttribute ("NodeB", "",
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    84
                   PointerValue (),
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    85
                   MakePointerAccessor (&ConfigTestObject::m_nodeB),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    86
                   MakePointerChecker<ConfigTestObject> ())
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    87
    .AddAttribute ("A", "",
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    88
                   IntegerValue (10),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    89
                   MakeIntegerAccessor (&ConfigTestObject::m_a),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    90
                   MakeIntegerChecker<int8_t> ())
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    91
    .AddAttribute ("B", "",
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    92
                   IntegerValue (9),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    93
                   MakeIntegerAccessor (&ConfigTestObject::m_b),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    94
                   MakeIntegerChecker<int8_t> ())
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    95
    .AddAttribute ("Source", "XX",
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    96
                   IntegerValue (-1),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    97
                   MakeIntegerAccessor (&ConfigTestObject::m_trace),
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
    98
                   MakeIntegerChecker<int16_t> ())
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
    99
    .AddTraceSource ("Source", "XX",
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
   100
                     MakeTraceSourceAccessor (&ConfigTestObject::m_trace))
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 7008
diff changeset
   101
  ;
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   102
  return tid;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   103
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   104
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   105
void
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   106
ConfigTestObject::SetNodeA (Ptr<ConfigTestObject> a)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   107
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   108
  m_nodeA = a;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   109
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   110
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   111
void
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   112
ConfigTestObject::SetNodeB (Ptr<ConfigTestObject> b)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   113
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   114
  m_nodeB = b;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   115
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   116
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   117
void 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   118
ConfigTestObject::AddNodeA (Ptr<ConfigTestObject> a)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   119
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   120
  m_nodesA.push_back (a);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   121
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   122
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   123
void 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   124
ConfigTestObject::AddNodeB (Ptr<ConfigTestObject> b)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   125
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   126
  m_nodesB.push_back (b);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   127
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   128
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   129
int8_t 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   130
ConfigTestObject::GetA (void) const
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   131
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   132
  return m_a;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   133
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   134
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   135
int8_t 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   136
ConfigTestObject::GetB (void) const
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   137
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   138
  return m_b;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   139
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   140
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   141
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   142
// Test for the ability to register and use a root namespace
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   143
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   144
class RootNamespaceConfigTestCase : public TestCase
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   145
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   146
public:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   147
  RootNamespaceConfigTestCase ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   148
  virtual ~RootNamespaceConfigTestCase () {}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   149
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   150
private:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   151
  virtual void DoRun (void);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   152
};
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   153
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   154
RootNamespaceConfigTestCase::RootNamespaceConfigTestCase ()
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   155
  : TestCase ("Check ability to register a root namespace and use it")
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   156
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   157
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   158
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   159
void
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   160
RootNamespaceConfigTestCase::DoRun (void)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   161
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   162
  IntegerValue iv;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   163
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   164
  // Create an object and register its attributes directly in the root 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   165
  // namespace.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   166
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   167
  Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   168
  Config::RegisterRootNamespaceObject (root);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   169
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   170
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   171
  // We should find the default values there.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   172
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   173
  root->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   174
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" not initialized as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   175
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   176
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   177
  // Now use the config mechanism to set the attribute; and we should find the
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   178
  // new value.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   179
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   180
  Config::Set ("/A", IntegerValue (1));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   181
  root->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   182
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 1, "Object Attribute \"A\" not set correctly");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   183
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   184
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   185
  // We should find the default values of "B" too.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   186
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   187
  root->GetAttribute ("B", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   188
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 9, "Object Attribute \"B\" not initialized as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   189
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   190
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   191
  // Now use the config mechanism to set the attribute; and we should find the
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   192
  // new value.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   193
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   194
  Config::Set ("/B", IntegerValue (-1));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   195
  root->GetAttribute ("B", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   196
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -1, "Object Attribute \"B\" not set correctly");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   197
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   198
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   199
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   200
// Test for the ability to add an object under the root namespace.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   201
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   202
class UnderRootNamespaceConfigTestCase : public TestCase
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   203
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   204
public:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   205
  UnderRootNamespaceConfigTestCase ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   206
  virtual ~UnderRootNamespaceConfigTestCase () {}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   207
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   208
private:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   209
  virtual void DoRun (void);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   210
};
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   211
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   212
UnderRootNamespaceConfigTestCase::UnderRootNamespaceConfigTestCase ()
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   213
  : TestCase ("Check ability to register an object under the root namespace and use it")
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   214
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   215
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   216
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   217
void
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   218
UnderRootNamespaceConfigTestCase::DoRun (void)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   219
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   220
  IntegerValue iv;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   221
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   222
  // Create an object and register its attributes directly in the root 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   223
  // namespace.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   224
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   225
  Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   226
  Config::RegisterRootNamespaceObject (root);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   227
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   228
  Ptr<ConfigTestObject> a = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   229
  root->SetNodeA (a);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   230
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   231
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   232
  // We should find the default values there.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   233
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   234
  a->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   235
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" not initialized as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   236
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   237
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   238
  // Now use the config mechanism to set the attribute; and we should find the
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   239
  // new value.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   240
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   241
  Config::Set ("/NodeA/A", IntegerValue (1));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   242
  a->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   243
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 1, "Object Attribute \"A\" not set correctly");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   244
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   245
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   246
  // We should find the default values of "B" too.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   247
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   248
  a->GetAttribute ("B", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   249
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 9, "Object Attribute \"B\" not initialized as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   250
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   251
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   252
  // Now use the config mechanism to set the attribute; and we should find the
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   253
  // new value.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   254
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   255
  Config::Set ("/NodeA/B", IntegerValue (-1));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   256
  a->GetAttribute ("B", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   257
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -1, "Object Attribute \"B\" not set correctly");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   258
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   259
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   260
  // Try and set through a nonexistent path.  Should do nothing.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   261
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   262
  Config::Set ("/NodeB/A", IntegerValue (1234));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   263
  a->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   264
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 1, "Object Attribute \"A\" unexpectedly set via bad path");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   265
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   266
  Config::Set ("/NodeB/B", IntegerValue (1234));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   267
  a->GetAttribute ("B", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   268
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -1, "Object Attribute \"B\" unexpectedly set via bad path");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   269
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   270
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   271
  // Step down one level of recursion and try again
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   272
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   273
  Ptr<ConfigTestObject> b = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   274
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   275
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   276
  // We should find the default values there.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   277
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   278
  b->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   279
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" not initialized as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   280
  b->GetAttribute ("B", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   281
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 9, "Object Attribute \"B\" not initialized as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   282
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   283
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   284
  // Now tell A that it has a B; and we should be able to set this new object's
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   285
  // Attributes.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   286
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   287
  a->SetNodeB (b);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   288
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   289
  Config::Set ("/NodeA/NodeB/A", IntegerValue (4));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   290
  Config::Set ("/NodeA/NodeB/B", IntegerValue (-4));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   291
  b->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   292
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 4, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   293
  b->GetAttribute ("B", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   294
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -4, "Object Attribute \"B\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   295
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   296
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   297
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   298
// Test for the ability to deal configure with vectors of objects.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   299
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   300
class ObjectVectorConfigTestCase : public TestCase
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   301
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   302
public:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   303
  ObjectVectorConfigTestCase ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   304
  virtual ~ObjectVectorConfigTestCase () {}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   305
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   306
private:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   307
  virtual void DoRun (void);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   308
};
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   309
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   310
ObjectVectorConfigTestCase::ObjectVectorConfigTestCase ()
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   311
  : TestCase ("Check ability to configure vectors of Object using regular expressions")
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   312
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   313
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   314
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   315
void
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   316
ObjectVectorConfigTestCase::DoRun (void)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   317
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   318
  IntegerValue iv;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   319
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   320
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   321
  // Create a root namespace object
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   322
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   323
  Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   324
  Config::RegisterRootNamespaceObject (root);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   325
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   326
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   327
  // Create an object under the root.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   328
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   329
  Ptr<ConfigTestObject> a = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   330
  root->SetNodeA (a);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   331
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   332
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   333
  // Create an object one level down.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   334
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   335
  Ptr<ConfigTestObject> b = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   336
  a->SetNodeB (b);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   337
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   338
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   339
  // Add four objects to the ObjectVector Attribute at the bottom of the 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   340
  // object hierarchy.  By this point, we believe that the Attributes
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   341
  // will be initialized correctly.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   342
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   343
  Ptr<ConfigTestObject> obj0 = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   344
  Ptr<ConfigTestObject> obj1 = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   345
  Ptr<ConfigTestObject> obj2 = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   346
  Ptr<ConfigTestObject> obj3 = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   347
  b->AddNodeB (obj0);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   348
  b->AddNodeB (obj1);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   349
  b->AddNodeB (obj2);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   350
  b->AddNodeB (obj3);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   351
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   352
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   353
  // Set an Attribute of the zeroth Object in the vector by explicitly writing
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   354
  // the '0' and make sure that only the one thing changed.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   355
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   356
  Config::Set ("/NodeA/NodeB/NodesB/0/A", IntegerValue (-11));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   357
  obj0->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   358
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -11, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   359
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   360
  obj1->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   361
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   362
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   363
  obj2->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   364
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   365
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   366
  obj3->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   367
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   368
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   369
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   370
  // Start using regular expression-like syntax to set Attributes.  First try
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   371
  // the OR syntax.  Make sure that the two objects changed and nothing else
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   372
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   373
  Config::Set ("/NodeA/NodeB/NodesB/0|1/A", IntegerValue (-12));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   374
  obj0->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   375
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -12, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   376
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   377
  obj1->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   378
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -12, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   379
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   380
  obj2->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   381
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   382
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   383
  obj3->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   384
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   385
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   386
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   387
  // Make sure that extra '|' are allowed at the start and end of the regular expression
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   388
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   389
  Config::Set ("/NodeA/NodeB/NodesB/|0|1|/A", IntegerValue (-13));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   390
  obj0->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   391
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -13, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   392
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   393
  obj1->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   394
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -13, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   395
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   396
  obj2->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   397
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   398
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   399
  obj3->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   400
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   401
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   402
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   403
  // Try the [x-y] syntax
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   404
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   405
  Config::Set ("/NodeA/NodeB/NodesB/[0-2]/A", IntegerValue (-14));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   406
  obj0->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   407
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   408
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   409
  obj1->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   410
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   411
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   412
  obj2->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   413
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   414
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   415
  obj3->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   416
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), 10, "Object Attribute \"A\" unexpectedly set");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   417
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   418
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   419
  // Try the [x-y] syntax at the other limit
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   420
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   421
  Config::Set ("/NodeA/NodeB/NodesB/[1-3]/A", IntegerValue (-15));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   422
  obj0->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   423
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -14, "Object Attribute \"A\" unexpectedly set");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   424
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   425
  obj1->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   426
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   427
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   428
  obj2->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   429
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   430
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   431
  obj3->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   432
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   433
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   434
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   435
  // Combine the [x-y] syntax and the OR sntax
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   436
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   437
  Config::Set ("/NodeA/NodeB/NodesB/[0-1]|3/A", IntegerValue (-16));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   438
  obj0->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   439
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -16, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   440
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   441
  obj1->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   442
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -16, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   443
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   444
  obj2->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   445
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -15, "Object Attribute \"A\" unexpectedly set");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   446
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   447
  obj3->GetAttribute ("A", iv);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   448
  NS_TEST_ASSERT_MSG_EQ (iv.Get (), -16, "Object Attribute \"A\" not set as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   449
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   450
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   451
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   452
// Test for the ability to trace configure with vectors of objects.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   453
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   454
class ObjectVectorTraceConfigTestCase : public TestCase
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   455
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   456
public:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   457
  ObjectVectorTraceConfigTestCase ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   458
  virtual ~ObjectVectorTraceConfigTestCase () {}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   459
7252
c8200621e252 rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents: 7169
diff changeset
   460
  void Trace (int16_t oldValue, int16_t newValue) { m_newValue = newValue; }
c8200621e252 rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents: 7169
diff changeset
   461
  void TraceWithPath (std::string path, int16_t old, int16_t newValue) { m_newValue = newValue; m_path = path; }
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   462
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   463
private:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   464
  virtual void DoRun (void);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   465
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   466
  int16_t m_newValue;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   467
  std::string m_path;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   468
};
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   469
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   470
ObjectVectorTraceConfigTestCase::ObjectVectorTraceConfigTestCase ()
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   471
  : TestCase ("Check ability to trace connect through vectors of Object using regular expressions")
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   472
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   473
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   474
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   475
void
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   476
ObjectVectorTraceConfigTestCase::DoRun (void)
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   477
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   478
  IntegerValue iv;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   479
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   480
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   481
  // Create a root namespace object
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   482
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   483
  Ptr<ConfigTestObject> root = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   484
  Config::RegisterRootNamespaceObject (root);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   485
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   486
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   487
  // Create an object under the root.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   488
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   489
  Ptr<ConfigTestObject> a = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   490
  root->SetNodeA (a);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   491
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   492
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   493
  // Create an object one level down.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   494
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   495
  Ptr<ConfigTestObject> b = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   496
  a->SetNodeB (b);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   497
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   498
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   499
  // Add four objects to the ObjectVector Attribute at the bottom of the 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   500
  // object hierarchy.  By this point, we believe that the Attributes
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   501
  // will be initialized correctly.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   502
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   503
  Ptr<ConfigTestObject> obj0 = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   504
  Ptr<ConfigTestObject> obj1 = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   505
  Ptr<ConfigTestObject> obj2 = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   506
  Ptr<ConfigTestObject> obj3 = CreateObject<ConfigTestObject> ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   507
  b->AddNodeB (obj0);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   508
  b->AddNodeB (obj1);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   509
  b->AddNodeB (obj2);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   510
  b->AddNodeB (obj3);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   511
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   512
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   513
  // Do a trace connect to some of the sources.  We already checked parsing of
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   514
  // the regular expressions, so we'll concentrate on the tracing part of the 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   515
  // puzzle here.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   516
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   517
  Config::ConnectWithoutContext ("/NodeA/NodeB/NodesB/[0-1]|3/Source", 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   518
                                 MakeCallback (&ObjectVectorTraceConfigTestCase::Trace, this));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   519
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   520
  // 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   521
  // If we bug the trace source referred to by index '0' above, we should see 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   522
  // the trace fire.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   523
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   524
  m_newValue = 0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   525
  obj0->SetAttribute ("Source", IntegerValue (-1));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   526
  NS_TEST_ASSERT_MSG_EQ (m_newValue, -1, "Trace 0 did not fire as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   527
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   528
  // 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   529
  // If we bug the trace source referred to by index '1' above, we should see 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   530
  // the trace fire.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   531
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   532
  m_newValue = 0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   533
  obj1->SetAttribute ("Source", IntegerValue (-2));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   534
  NS_TEST_ASSERT_MSG_EQ (m_newValue, -2, "Trace 1 did not fire as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   535
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   536
  // 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   537
  // If we bug the trace source referred to by index '2' which is skipped above,
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   538
  // we should not see the trace fire.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   539
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   540
  m_newValue = 0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   541
  obj2->SetAttribute ("Source", IntegerValue (-3));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   542
  NS_TEST_ASSERT_MSG_EQ (m_newValue, 0, "Trace 2 fired unexpectedly");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   543
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   544
  // 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   545
  // If we bug the trace source referred to by index '3' above, we should see 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   546
  // the trace fire.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   547
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   548
  m_newValue = 0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   549
  obj3->SetAttribute ("Source", IntegerValue (-4));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   550
  NS_TEST_ASSERT_MSG_EQ (m_newValue, -4, "Trace 3 did not fire as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   551
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   552
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   553
  // Do a trace connect (with context) to some of the sources.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   554
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   555
  Config::Connect ("/NodeA/NodeB/NodesB/[0-1]|3/Source", 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   556
                   MakeCallback (&ObjectVectorTraceConfigTestCase::TraceWithPath, this));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   557
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   558
  // 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   559
  // If we bug the trace source referred to by index '0' above, we should see 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   560
  // the trace fire with the expected context path.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   561
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   562
  m_newValue = 0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   563
  m_path = "";
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   564
  obj0->SetAttribute ("Source", IntegerValue (-1));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   565
  NS_TEST_ASSERT_MSG_EQ (m_newValue, -1, "Trace 0 did not fire as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   566
  NS_TEST_ASSERT_MSG_EQ (m_path, "/NodeA/NodeB/NodesB/0/Source", "Trace 0 did not provide expected context");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   567
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   568
  // 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   569
  // If we bug the trace source referred to by index '1' above, we should see 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   570
  // the trace fire with the expected context path.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   571
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   572
  m_newValue = 0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   573
  m_path = "";
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   574
  obj1->SetAttribute ("Source", IntegerValue (-2));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   575
  NS_TEST_ASSERT_MSG_EQ (m_newValue, -2, "Trace 1 did not fire as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   576
  NS_TEST_ASSERT_MSG_EQ (m_path, "/NodeA/NodeB/NodesB/1/Source", "Trace 1 did not provide expected context");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   577
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   578
  // 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   579
  // If we bug the trace source referred to by index '2' which is skipped above,
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   580
  // we should not see the trace fire.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   581
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   582
  m_newValue = 0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   583
  m_path = "";
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   584
  obj2->SetAttribute ("Source", IntegerValue (-3));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   585
  NS_TEST_ASSERT_MSG_EQ (m_newValue, 0, "Trace 2 fired unexpectedly");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   586
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   587
  // 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   588
  // If we bug the trace source referred to by index '3' above, we should see 
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   589
  // the trace fire with the expected context path.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   590
  //
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   591
  m_newValue = 0;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   592
  m_path = "";
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   593
  obj3->SetAttribute ("Source", IntegerValue (-4));
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   594
  NS_TEST_ASSERT_MSG_EQ (m_newValue, -4, "Trace 3 did not fire as expected");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   595
  NS_TEST_ASSERT_MSG_EQ (m_path, "/NodeA/NodeB/NodesB/1/Source", "Trace 1 did not provide expected context");
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   596
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   597
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   598
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   599
// The Test Suite that glues all of the Test Cases together.
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   600
// ===========================================================================
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   601
class ConfigTestSuite : public TestSuite
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   602
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   603
public:
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   604
  ConfigTestSuite ();
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   605
};
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   606
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   607
ConfigTestSuite::ConfigTestSuite ()
7008
82c66d5c01f7 Relabel all build verification tests (BVT) to be unit tests (UNIT)
Mitch Watrous <watrous@u.washington.edu>
parents: 7003
diff changeset
   608
  : TestSuite ("config", UNIT)
7003
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   609
{
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   610
  AddTestCase (new RootNamespaceConfigTestCase);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   611
  AddTestCase (new UnderRootNamespaceConfigTestCase);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   612
  AddTestCase (new ObjectVectorConfigTestCase);
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   613
}
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   614
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   615
static ConfigTestSuite configTestSuite;
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   616
a0b1500cdaad Move tests from core module to its test library and update CHANGES.html
Mitch Watrous <watrous@u.washington.edu>
parents:
diff changeset
   617
} // namespace ns3