Commit fc37cd88 authored by Martin Mrovec's avatar Martin Mrovec

ENH: Added funit tests for connection_m

parent 68690ce9
......@@ -6,24 +6,39 @@
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.photran.core.GFortranErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.photran.core.GFortranErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser" id="photran.managedbuild.config.gnu.fortran.win32.exe.debug.338229552" name="Debug" parent="photran.managedbuild.config.gnu.fortran.win32.exe.debug">
<folderInfo id="photran.managedbuild.config.gnu.fortran.win32.exe.debug.338229552." name="/" resourcePath="">
<toolChain id="photran.managedbuild.toolchain.gnu.fortran.win32.exe.debug.609204123" name="GCC Fortran" superClass="photran.managedbuild.toolchain.gnu.fortran.win32.exe.debug">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.PE" id="photran.managedbuild.target.gnu.platform.win32.exe.debug.1367946370" name="Debug Platform" osList="win32" superClass="photran.managedbuild.target.gnu.platform.win32.exe.debug"/>
<builder buildPath="${workspace_loc:/4neuro}/Debug" id="photran.managedbuild.target.gnu.builder.win32.exe.debug.1825478107" managedBuildOn="true" name="Gnu Make Builder.Debug" superClass="photran.managedbuild.target.gnu.builder.win32.exe.debug"/>
<tool id="photran.managedbuild.tool.gnu.c.compiler.win32.exe.debug.778780997" name="GCC C Compiler" superClass="photran.managedbuild.tool.gnu.c.compiler.win32.exe.debug"/>
<tool id="photran.managedbuild.tool.gnu.fortran.compiler.win32.exe.debug.1743211871" name="GNU Fortran Compiler" superClass="photran.managedbuild.tool.gnu.fortran.compiler.win32.exe.debug"/>
<tool id="photran.managedbuild.tool.gnu.fortran.linker.win32.exe.debug.437267444" name="GNU Fortran Linker" superClass="photran.managedbuild.tool.gnu.fortran.linker.win32.exe.debug"/>
<tool id="photran.managedbuild.tool.gnu.assembler.win32.exe.debug.432119483" name="GCC Assembler" superClass="photran.managedbuild.tool.gnu.assembler.win32.exe.debug"/>
<toolChain id="photran.managedbuild.toolchain.gnu.fortran.win32.exe.debug.609204123" name="GCC Fortran" nonInternalBuilderId="photran.managedbuild.target.gnu.builder.win32.exe.debug" superClass="photran.managedbuild.toolchain.gnu.fortran.win32.exe.debug">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.PE;org.eclipse.cdt.core.Cygwin_PE;org.eclipse.cdt.core.GNU_ELF" id="photran.managedbuild.target.gnu.platform.win32.exe.debug.1367946370" name="Debug Platform" osList="win32" superClass="photran.managedbuild.target.gnu.platform.win32.exe.debug"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/4neuro}/Debug" cleanBuildTarget="clean" command="./build.sh" id="org.eclipse.cdt.build.core.internal.builder.1589687311" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
<tool id="photran.managedbuild.tool.gnu.c.compiler.win32.exe.debug.778780997" name="GCC C Compiler" superClass="photran.managedbuild.tool.gnu.c.compiler.win32.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2016360279" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="photran.managedbuild.tool.gnu.fortran.compiler.win32.exe.debug.1743211871" name="GNU Fortran Compiler" superClass="photran.managedbuild.tool.gnu.fortran.compiler.win32.exe.debug">
<option id="gnu.fortran.compiler.option.include.paths.769321882" name="Include paths (-I)" superClass="gnu.fortran.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;C:\msys64\mingw32\bin&quot;"/>
</option>
<inputType id="photran.managedbuild.tool.gnu.fortran.compiler.input.2145534976" superClass="photran.managedbuild.tool.gnu.fortran.compiler.input"/>
</tool>
<tool id="photran.managedbuild.tool.gnu.fortran.linker.win32.exe.debug.437267444" name="GNU Fortran Linker" superClass="photran.managedbuild.tool.gnu.fortran.linker.win32.exe.debug">
<inputType id="photran.managedbuild.tool.gnu.fortran.linker.input.1813142317" superClass="photran.managedbuild.tool.gnu.fortran.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="photran.managedbuild.tool.gnu.assembler.win32.exe.debug.432119483" name="GCC Assembler" superClass="photran.managedbuild.tool.gnu.assembler.win32.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1934367141" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
......@@ -35,6 +50,8 @@
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
......@@ -47,23 +64,50 @@
<configuration artifactName="${ProjName}" buildProperties="" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.photran.core.GFortranErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser" id="photran.managedbuild.config.gnu.fortran.win32.exe.release.1957908145" name="Release" parent="photran.managedbuild.config.gnu.fortran.win32.exe.release">
<folderInfo id="photran.managedbuild.config.gnu.fortran.win32.exe.release.1957908145." name="/" resourcePath="">
<toolChain id="photran.managedbuild.toolchain.gnu.fortran.win32.exe.release.1111724220" name="GCC Fortran" superClass="photran.managedbuild.toolchain.gnu.fortran.win32.exe.release">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.PE" id="photran.managedbuild.target.gnu.platform.fortran.win32.exe.release.1225476161" name="Release Platform" osList="win32" superClass="photran.managedbuild.target.gnu.platform.fortran.win32.exe.release"/>
<builder buildPath="${workspace_loc:/4neuro}/Release" id="photran.managedbuild.target.gnu.builder.win32.exe.release.1043598058" managedBuildOn="true" name="Gnu Make Builder.Release" superClass="photran.managedbuild.target.gnu.builder.win32.exe.release"/>
<tool id="photran.managedbuild.tool.gnu.c.compiler.win32.exe.release.1436794482" name="GCC C Compiler" superClass="photran.managedbuild.tool.gnu.c.compiler.win32.exe.release"/>
<tool id="photran.managedbuild.tool.gnu.fortran.compiler.win32.exe.release.1119644158" name="GNU Fortran Compiler" superClass="photran.managedbuild.tool.gnu.fortran.compiler.win32.exe.release"/>
<tool id="photran.managedbuild.tool.gnu.fortran.linker.win32.exe.release.1754062441" name="GNU Fortran Linker" superClass="photran.managedbuild.tool.gnu.fortran.linker.win32.exe.release"/>
<tool id="photran.managedbuild.tool.gnu.assembler.win32.exe.release.1039785129" name="GCC Assembler" superClass="photran.managedbuild.tool.gnu.assembler.win32.exe.release"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.PE;org.eclipse.cdt.core.Cygwin_PE;org.eclipse.cdt.core.GNU_ELF" id="photran.managedbuild.target.gnu.platform.fortran.win32.exe.release.1225476161" name="Release Platform" osList="win32" superClass="photran.managedbuild.target.gnu.platform.fortran.win32.exe.release"/>
<builder buildPath="${workspace_loc:/4neuro}/Release" id="photran.managedbuild.target.gnu.builder.win32.exe.release.1043598058" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="photran.managedbuild.target.gnu.builder.win32.exe.release"/>
<tool id="photran.managedbuild.tool.gnu.c.compiler.win32.exe.release.1436794482" name="GCC C Compiler" superClass="photran.managedbuild.tool.gnu.c.compiler.win32.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1856045908" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="photran.managedbuild.tool.gnu.fortran.compiler.win32.exe.release.1119644158" name="GNU Fortran Compiler" superClass="photran.managedbuild.tool.gnu.fortran.compiler.win32.exe.release">
<inputType id="photran.managedbuild.tool.gnu.fortran.compiler.input.1812093560" superClass="photran.managedbuild.tool.gnu.fortran.compiler.input"/>
</tool>
<tool id="photran.managedbuild.tool.gnu.fortran.linker.win32.exe.release.1754062441" name="GNU Fortran Linker" superClass="photran.managedbuild.tool.gnu.fortran.linker.win32.exe.release">
<inputType id="photran.managedbuild.tool.gnu.fortran.linker.input.197505219" superClass="photran.managedbuild.tool.gnu.fortran.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="photran.managedbuild.tool.gnu.assembler.win32.exe.release.1039785129" name="GCC Assembler" superClass="photran.managedbuild.tool.gnu.assembler.win32.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.440312833" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="4neuro.photran.managedbuild.target.gnu.fortran.win32.exe.1809620819" name="Executable (Gnu Fortran on Windows)" projectType="photran.managedbuild.target.gnu.fortran.win32.exe"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/4neuro"/>
</configuration>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/4neuro"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="photran.managedbuild.config.gnu.fortran.win32.exe.debug.338229552;photran.managedbuild.config.gnu.fortran.win32.exe.debug.338229552.">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="photran.managedbuild.config.gnu.fortran.win32.exe.debug.338229552;photran.managedbuild.config.gnu.fortran.win32.exe.debug.338229552.;photran.managedbuild.tool.gnu.c.compiler.win32.exe.debug.778780997;cdt.managedbuild.tool.gnu.c.compiler.input.2016360279">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
</storageModule>
</cproject>
......@@ -6,7 +6,7 @@ enable_language(Fortran)
# Default installation location #
#-------------------------------#
# Linux: /usr/local
# Windows: c:/Program Files
# Windows: C:/Users/Marti/OneDrive/Dokumenty/Fortran/git4Neuro/4NeuroMrovma/4Neuro/t
#------------#
# Build type #
......
......@@ -3,3 +3,4 @@
cd build;
./connection_test.out
funit connection_m
test_suite connection_m
! Global variables declaration
type(neuron_t), target :: n1
type(neuron_t), target :: n2
type(neuron_t), pointer :: n1_p
type(neuron_t), pointer :: n2_p
type(neuron_t), pointer :: dummy_p
type(interval_connection_t), pointer :: con
! Setup before each test
setup
write(*,*) 'Creating instances of the class neuron_t...'
n1 = neuron_t(21.3)
n2 = neuron_t(13.7)
write(*,*) 'Assigning instances to pointer...'
n1_p => n1
n2_p => n2
print *, 'Creating an instance of the class interval_connection_t...'
con => interval_connection_t(n1_p, n2_p, 5.25)
nullify(dummy_p)
end setup
! After each test do the cleanup
teardown
write(*,*) 'Deallocating everything.'
deallocate(con)
deallocate(n1_p)
deallocate(n2_p)
nullify(dummy_p)
end teardown
! Test of getters and setters
test getters_setters
write(*,*) 'Test of getters and setters.'
! Test of get_weight
assert_real_equal(con%get_weight(), 5.25e+0)
! Test of adjust_weight
call con%adjust_weight(1.0)
assert_real_equal(con%get_weight(), 6.25e+0)
end test
test input_and_output_neurons
write(*,*) 'Test of input and output neurons.'
! Input neuron
dummy_p => con%get_input_neuron()
assert_real_equal(dummy_p%get_state(),21.3d+0)
! Output neuron
dummy_p => con%get_output_neuron()
assert_real_equal(dummy_p%get_state(),13.7d+0)
end test
test pass_signal
write(*,*) 'Test of passing a signal.'
dummy_p => con%get_input_neuron()
call con%pass_signal()
assert_real_equal(dummy_p%get_state(), 111.825d+0)
end test
end test_suite
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment