Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lib4neuro
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
MolDyn
lib4neuro
Commits
5a7a76ac
Commit
5a7a76ac
authored
7 years ago
by
Martin Beseda
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Improved unit tests for the module 'connection_m'.
parent
2cf63400
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/connection_test.f08
+63
-10
63 additions, 10 deletions
src/connection_test.f08
with
63 additions
and
10 deletions
src/connection_test.f08
+
63
−
10
View file @
5a7a76ac
program
a
program
connection_test
use
connection_m
use
neuron_dummy_m
...
...
@@ -11,23 +11,76 @@ program a
type
(
interval_connection_t
),
pointer
::
con
n1
=
neuron_t
(
21
)
n2
=
neuron_t
(
13
)
print
*
,
'+---------------------------------------------+'
print
*
,
'| STARTING TESTING OF THE MODULE CONNECTION_M |'
print
*
,
'+---------------------------------------------+'
print
*
,
'Creating instances of the class neuron_t...'
n1
=
neuron_t
(
21.3
)
n2
=
neuron_t
(
13.7
)
print
*
,
'neuron_t instances were created successfully.'
print
*
,
'Assigning instances to pointer...'
n1_p
=>
n1
n2_p
=>
n2
print
*
,
'Assignment was successful.'
print
*
,
'Creating an instance of the class interval_connection_t...'
con
=>
interval_connection_t
(
n1_p
,
n2_p
,
5.25
)
print
*
,
'The instance of the class interval_connection_t was created successfully.'
con
=>
interval_connection_t
(
n1_p
,
n2_p
,
5.0
)
print
*
,
'Testing get_weight() method...'
if
(
con
%
get_weight
()
==
5.25
)
then
print
*
,
'Test of get_weight() was successfull.'
else
print
*
,
'ERROR testing method get_weight()!'
stop
-1
end
if
print
*
,
'weight: '
,
con
%
get_weight
()
print
*
,
'Testing adjust_weight() method...'
call
con
%
adjust_weight
(
1.0
)
if
(
con
%
get_weight
()
==
6.25
)
then
print
*
,
'Test of adjust_weight() was successful.'
else
print
*
,
'ERROR testing method adjust_weight()!'
stop
-1
end
if
print
*
,
'Assigning input neuron to a pointer using get_input_neuron()...'
dummy_p
=>
con
%
get_input_neuron
()
print
*
,
dummy_p
%
get_state
()
print
*
,
'Assignment was successful.'
print
*
,
'Testing method get_state() on the input neuron...'
if
(
dummy_p
%
get_state
()
==
21.3
)
then
print
*
,
'Test was successful.'
else
print
*
,
'ERROR using method get_state() on the input neuron!'
stop
-1
end
if
print
*
,
'Assigning output neuron to a pointer using get_output_neuron()...'
dummy_p
=>
con
%
get_output_neuron
()
print
*
,
dummy_p
%
get_state
()
print
*
,
'Assignment was successful.'
call
con
%
pass_signal
()
print
*
,
'Testing method get_state() on the output neuron...'
if
(
dummy_p
%
get_state
()
==
13.7
)
then
print
*
,
'Test was successful.'
else
print
*
,
'ERROR using method get_state() on the output neuron!'
stop
-1
end
if
print
*
,
dummy_p
%
get_state
()
print
*
,
'Assigning the value input*weight to the output neuron using method pass_signal()...'
call
con
%
pass_signal
()
print
*
,
'Retrieving state of the output neuron and testing the value...'
if
(
dummy_p
%
get_state
()
==
133.125
)
then
print
*
,
'Test was successful.'
else
print
*
,
'ERROR using method pass_signal()!'
stop
-1
end
if
end
program
a
print
*
,
'+-------------------------------------------------------------+'
print
*
,
'| ALL TESTS OF THE MODULE CONNECTION_M WERE RUN SUCCESSFULLY. |'
print
*
,
'+-------------------------------------------------------------+'
end
program
connection_test
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