Skip to content

Commit

Permalink
chore(assym_net_test): invoke call_assert macro
Browse files Browse the repository at this point in the history
  • Loading branch information
rouson committed Nov 24, 2024
1 parent e0a710f commit 2042b62
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions test/asymmetric_network_test_m.F90
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
! Copyright (c), The Regents of the University of California
! Terms of use are as specified in LICENSE.txt

#include "assert_macros.h"

module asymmetric_network_test_m
!! Define tests in which the desired output depends asymmetrically on the inputs

! External dependencies
use assert_m, only : assert
use assert_m
use julienne_m, only : &
test_t, test_result_t, vector_test_description_t, test_description_substring, string_t, vector_function_strategy_t

Expand Down Expand Up @@ -74,7 +77,7 @@ function xor_and_2nd_input_network() result(neural_network)
allocate(biases(n_max, layers))

l = 1
call assert(n(l-1)==2, "l=1: n(l-1)==2")
call_assert(n(l-1)==2)
j = 1
weights(j,1:n(l-1),l) = [1,0]
j = 2
Expand All @@ -84,10 +87,10 @@ function xor_and_2nd_input_network() result(neural_network)
j = 4
weights(j,1:n(l-1),l) = [0,1]
biases(1:n(l),l) = [0., -1.99, 0., 0.]
call assert(j == n(l), "l=1; j=4: j == n(l)")
call_assert(j == n(l))

l = 2
call assert(n(l-1)==4, "l=2: n(l-1)==2")
call_assert(n(l-1)==4)
j = 1
weights(j,1:n(l-1),l) = [0,0,0,0]
j = 2
Expand All @@ -97,15 +100,15 @@ function xor_and_2nd_input_network() result(neural_network)
j = 4
weights(j,1:n(l-1),l) = [0,0,0,1]
biases(1:n(l),l) = [0,0,0,0]
call assert(j == n(l), "l=1; j=4: j == n(l)")
call_assert(j == n(l))


l = 3
call assert(n(l-1)==4, "l=3: n(l-1)==2")
call_assert(n(l-1)==4)
j = 1
weights(j,1:n(l-1),l) = [0,1,0,1]
biases(1:n(l),l) = [-1]
call assert(j == n(l), "l=3; j=1: j == n(l)")
call_assert(j == n(l))

neural_network = neural_network_t(metadata, weights, biases, nodes = n)

Expand Down

0 comments on commit 2042b62

Please sign in to comment.