feisty meow concerns codebase
2.140
test_enum_adapters.cpp
Go to the documentation of this file.
1
/*
2
* Name : test_enumerate_adapters *
3
* Author : Chris Koeritz *
4
* Purpose: Makes sure that the adapter enumerator function is working properly.
5
**
6
* Copyright (c) 2003-$now By Author. This program is free software; you can *
7
* redistribute it and/or modify it under the terms of the GNU General Public *
8
* License as published by the Free Software Foundation; either version 2 of *
9
* the License or (at your option) any later version. This is online at: *
10
* http://www.fsf.org/copyleft/gpl.html *
11
* Please send any updates to: fred@gruntose.com *
12
*/
13
14
#include <
application/hoople_main.h
>
15
#include <
basis/astring.h
>
16
#include <
basis/functions.h
>
17
#include <
loggers/critical_events.h
>
18
#include <
loggers/program_wide_logger.h
>
19
#include <
sockets/tcpip_stack.h
>
20
#include <
structures/static_memory_gremlin.h
>
21
#include <
structures/string_array.h
>
22
#include <
unit_test/unit_base.h
>
23
24
#include <stdio.h>
25
//#include <string.h>
26
27
using namespace
application
;
28
using namespace
basis
;
29
using namespace
loggers
;
30
using namespace
mathematics
;
31
using namespace
sockets
;
32
using namespace
structures
;
33
using namespace
textual
;
34
using namespace
timely
;
35
using namespace
unit_test
;
36
37
#define LOG(to_print) EMERGENCY_LOG(program_wide_logger().get(), astring(to_print))
38
39
class
test_enum_adapaters :
public
virtual
unit_base
,
virtual
public
application_shell
40
{
41
public
:
42
test_enum_adapaters() {}
43
DEFINE_CLASS_NAME
(
"test_enum_adapaters"
);
44
virtual
int
execute();
45
};
46
47
int
test_enum_adapaters::execute()
48
{
49
FUNCDEF
(
"execute"
);
50
tcpip_stack
stack
;
51
52
string_array
ips;
53
bool
did_it =
stack
.enumerate_adapters(ips);
54
if
(!did_it)
55
deadly_error
(class_name(), func,
"could not enumerate adapters"
);
56
57
for
(
int
i = 0; i < ips.
length
(); i++) {
58
log(
a_sprintf
(
"%d: "
, i+1) + ips[i]);
59
}
60
61
return
final_report();
62
}
63
64
HOOPLE_MAIN
(test_enum_adapaters, )
65
astring.h
application::application_shell
The application_shell is a base object for console programs.
Definition:
application_shell.h:33
basis::a_sprintf
a_sprintf is a specialization of astring that provides printf style support.
Definition:
astring.h:440
basis::array::length
int length() const
Returns the current reported length of the allocated C array.
Definition:
array.h:115
sockets::tcpip_stack
Helpful functions for interacting with TCP/IP stacks.
Definition:
tcpip_stack.h:38
structures::stack
An abstraction that represents a stack data structure.
Definition:
stack.h:30
structures::string_array
An array of strings with some additional helpful methods.
Definition:
string_array.h:32
unit_test::unit_base
Definition:
unit_base.h:59
critical_events.h
deadly_error
#define deadly_error(c, f, i)
Definition:
critical_events.h:87
DEFINE_CLASS_NAME
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
Definition:
enhance_cpp.h:45
FUNCDEF
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Definition:
enhance_cpp.h:57
functions.h
hoople_main.h
Provides macros that implement the 'main' program of an application.
HOOPLE_MAIN
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Definition:
hoople_main.h:61
application
Implements an application lock to ensure only one is running at once.
Definition:
application_shell.cpp:40
basis
The guards collection helps in testing preconditions and reporting errors.
Definition:
array.h:30
loggers
A logger that sends to the console screen using the standard output device.
Definition:
combo_logger.cpp:36
mathematics
An extension to floating point primitives providing approximate equality.
Definition:
averager.h:21
sockets
Provides access to the operating system's socket methods.
Definition:
base_address.h:26
structures
A dynamic container class that holds any kind of object via pointers.
Definition:
amorph.h:55
textual
Definition:
byte_formatter.cpp:38
timely
#include <time.h>
Definition:
earth_time.cpp:37
unit_test
Useful support functions for unit testing, especially within hoople.
Definition:
unit_base.cpp:35
program_wide_logger.h
static_memory_gremlin.h
string_array.h
tcpip_stack.h
unit_base.h
octopi
library
tests_sockets
test_enum_adapters.cpp
Generated by
1.9.1