Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_io
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sbalzarini Lab
Software
Parallel Computing
OpenFPM
openfpm_io
Commits
d2a7fbed
Commit
d2a7fbed
authored
10 years ago
by
Pietro Incardona
Browse files
Options
Downloads
Patches
Plain Diff
Addedd GraphMLWriter unit test
parent
f6749b75
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/GraphMLWriter_unit_tests.hpp
+89
-0
89 additions, 0 deletions
src/GraphMLWriter_unit_tests.hpp
with
89 additions
and
0 deletions
src/GraphMLWriter_unit_tests.hpp
0 → 100644
+
89
−
0
View file @
d2a7fbed
/*
* GraphMLWriter_unit_tests.hpp
*
* Created on: Dec 9, 2014
* Author: i-bird
*/
#ifndef GRAPHMLWRITER_UNIT_TESTS_HPP_
#define GRAPHMLWRITER_UNIT_TESTS_HPP_
#define GS_SIZE 128
#include
"GraphMLWriter.hpp"
#include
"Graph/CartesianGraphFactory.hpp"
BOOST_AUTO_TEST_SUITE
(
graphml_writer_test
)
/*!
*
* Test node and edge
*
*/
struct
ne_cp
{
//! The node contain several properties
typedef
boost
::
fusion
::
vector
<
float
,
float
,
float
,
double
,
long
int
,
int
,
std
::
string
>
type
;
typedef
typename
memory_traits_inte
<
type
>::
type
memory_int
;
typedef
typename
memory_traits_lin
<
type
>::
type
memory_lin
;
//! define attributes names
struct
attributes
{
static
const
std
::
string
name
[];
};
//! The data
type
data
;
//! x property id in boost::fusion::vector
static
const
unsigned
int
x
=
0
;
//! y property id in boost::fusion::vector
static
const
unsigned
int
y
=
1
;
//! z property id in boost::fusion::vector
static
const
unsigned
int
z
=
2
;
//! float_num property id in boost::fusion::vector
static
const
unsigned
int
float_num
=
3
;
//! double_num property id in boost::fusion::vector
static
const
unsigned
int
double_num
=
4
;
//! long_num property id in boost::fusion::vector
static
const
unsigned
int
long_num
=
5
;
//! integer property id in boost::fusion::vector
static
const
unsigned
int
integer
=
6
;
//! string property id in boost::fusion::vector
static
const
unsigned
int
string
=
7
;
//! total number of properties boost::fusion::vector
static
const
unsigned
int
max_prop
=
8
;
};
// Initialize the attributes strings array
const
std
::
string
ne_cp
::
attributes
::
name
[]
=
{
"x"
,
"y"
,
"z"
,
"float_num"
,
"double_num"
,
"long_num"
,
"integer"
,
"string"
};
BOOST_AUTO_TEST_CASE
(
graphml_writer_use
)
{
//! Create a graph
CartesianGraphFactory
<
3
,
Graph_CSR
<
ne_cp
,
ne_cp
>>
g_factory
;
// Cartesian grid
std
::
vector
<
size_t
>
sz
;
sz
.
push_back
(
GS_SIZE
);
sz
.
push_back
(
GS_SIZE
);
sz
.
push_back
(
GS_SIZE
);
// Box
Box
<
3
,
float
>
box
({
0.0
,
0.0
,
0.0
},{
1.0
,
1.0
,
1.0
});
Graph_CSR
<
ne_cp
,
ne_cp
>
g_csr
=
g_factory
.
construct
<
5
,
float
,
2
>
(
sz
,
box
);
GraphMLWriter
<
Graph_CSR
<
ne_cp
,
ne_cp
>>
gw
(
g_csr
);
gw
.
write
(
"test_graph.gml"
);
}
BOOST_AUTO_TEST_SUITE_END
()
#endif
/* GRAPHMLWRITER_UNIT_TESTS_HPP_ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment