From 1dd08fcfe43315453e9ee7ac9dac4aba8a05fd19 Mon Sep 17 00:00:00 2001 From: Pierre MARECHAL Date: Fri, 30 Oct 2009 23:03:24 +0100 Subject: [PATCH] ATOMS: Add tests --- .../atoms/tests/unit_tests/atomsIsLoaded.dia.ref | 57 ++++++++++++++++++ .../atoms/tests/unit_tests/atomsIsLoaded.tst | 61 ++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 scilab/modules/atoms/tests/unit_tests/atomsIsLoaded.dia.ref create mode 100644 scilab/modules/atoms/tests/unit_tests/atomsIsLoaded.tst diff --git a/scilab/modules/atoms/tests/unit_tests/atomsIsLoaded.dia.ref b/scilab/modules/atoms/tests/unit_tests/atomsIsLoaded.dia.ref new file mode 100644 index 0000000..c78fe39 --- /dev/null +++ b/scilab/modules/atoms/tests/unit_tests/atomsIsLoaded.dia.ref @@ -0,0 +1,57 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- JVM NOT MANDATORY --> +load("SCI/modules/atoms/macros/atoms_internals/lib"); +// Do not use the autoload system +config_autoload = atomsGetConfig("autoloadAddAfterInstall"); +config_Verbose = atomsGetConfig("Verbose"); +atomsSetConfig("autoloadAddAfterInstall","False"); +atomsSetConfig("Verbose" ,"False"); +// Load the 2nd scenario : See scene2.test.atoms.scilab.org.txt +// ============================================================================= +atomsRepositorySetOfl("http://scene1.test.atoms.scilab.org"); +atomsSystemUpdate(); +// Install toolbox N°2 +atomsInstall(["toolbox_2","2.0"],"user"); +// Check installation +if ~ atomsIsInstalled(["toolbox_1","1.0","user"]) then bugmes();quit;end +if ~ atomsIsInstalled(["toolbox_2","2.0","user"]) then bugmes();quit;end +atomsLoad(["toolbox_2","2.0","user"]); + +Start Toolbox 2 + Load macros + +Start Toolbox 1 + Load macros + Load gateways + +if ~ atomsIsLoaded("toolbox_2") then bugmes();quit;end +if ~ atomsIsLoaded(["toolbox_2","2.0"]) then bugmes();quit;end +if ~ atomsIsLoaded(["toolbox_2","2.0","user"]) then bugmes();quit;end +if ~ atomsIsLoaded("toolbox_1") then bugmes();quit;end +if ~ atomsIsLoaded(["toolbox_1","1.0"]) then bugmes();quit;end +if ~ atomsIsLoaded(["toolbox_1","1.0","user"]) then bugmes();quit;end +if atomsIsLoaded(["toolbox_1","1.0","allusers"]) then bugmes();quit;end +if atomsIsLoaded(["toolbox_2","2.0","allusers"]) then bugmes();quit;end +A = [ "toolbox_1" "1.0" "user" ; .. + "toolbox_2" "2.0" "user" ; .. + "toolbox_2" "" "user" ; .. + "toolbox_2" "2.0" "" ; .. + "toolbox_2" "" "" ; .. + "toolbox_2" "2.0" "allusers" ]; +if or(atomsIsLoaded(A) <> [%T ; %T ; %T ; %T ; %T ; %F]) then bugmes();quit;end +// Remove toolbox_2 +// ============================================================================= +atomsRemove("toolbox_2","user"); + the package toolbox_2 (2.0) is currently loaded, It will removed at next Scilab restart + the package toolbox_1 (1.0) is currently loaded, It will removed at next Scilab restart +// Restore original values +// ============================================================================= +atomsSetConfig("autoloadAddAfterInstall",config_autoload); +atomsSetConfig("Verbose" ,config_Verbose); +atomsRepositorySetOfl("http://atoms.scilab.org"); +atomsSystemUpdate(); diff --git a/scilab/modules/atoms/tests/unit_tests/atomsIsLoaded.tst b/scilab/modules/atoms/tests/unit_tests/atomsIsLoaded.tst new file mode 100644 index 0000000..ec409bb --- /dev/null +++ b/scilab/modules/atoms/tests/unit_tests/atomsIsLoaded.tst @@ -0,0 +1,61 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO - Pierre MARECHAL +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- JVM NOT MANDATORY --> + +load("SCI/modules/atoms/macros/atoms_internals/lib"); + +// Do not use the autoload system +config_autoload = atomsGetConfig("autoloadAddAfterInstall"); +config_Verbose = atomsGetConfig("Verbose"); +atomsSetConfig("autoloadAddAfterInstall","False"); +atomsSetConfig("Verbose" ,"False"); + +// Load the 2nd scenario : See scene2.test.atoms.scilab.org.txt +// ============================================================================= +atomsRepositorySetOfl("http://scene1.test.atoms.scilab.org"); +atomsSystemUpdate(); + +// Install toolbox N°2 +atomsInstall(["toolbox_2","2.0"],"user"); + +// Check installation +if ~ atomsIsInstalled(["toolbox_1","1.0","user"]) then pause, end +if ~ atomsIsInstalled(["toolbox_2","2.0","user"]) then pause, end + +atomsLoad(["toolbox_2","2.0","user"]); + +if ~ atomsIsLoaded("toolbox_2") then pause, end +if ~ atomsIsLoaded(["toolbox_2","2.0"]) then pause, end +if ~ atomsIsLoaded(["toolbox_2","2.0","user"]) then pause, end + +if ~ atomsIsLoaded("toolbox_1") then pause, end +if ~ atomsIsLoaded(["toolbox_1","1.0"]) then pause, end +if ~ atomsIsLoaded(["toolbox_1","1.0","user"]) then pause, end + +if atomsIsLoaded(["toolbox_1","1.0","allusers"]) then pause, end +if atomsIsLoaded(["toolbox_2","2.0","allusers"]) then pause, end + +A = [ "toolbox_1" "1.0" "user" ; .. + "toolbox_2" "2.0" "user" ; .. + "toolbox_2" "" "user" ; .. + "toolbox_2" "2.0" "" ; .. + "toolbox_2" "" "" ; .. + "toolbox_2" "2.0" "allusers" ]; + +if or(atomsIsLoaded(A) <> [%T ; %T ; %T ; %T ; %T ; %F]) then pause, end + +// Remove toolbox_2 +// ============================================================================= +atomsRemove("toolbox_2","user"); + +// Restore original values +// ============================================================================= +atomsSetConfig("autoloadAddAfterInstall",config_autoload); +atomsSetConfig("Verbose" ,config_Verbose); +atomsRepositorySetOfl("http://atoms.scilab.org"); +atomsSystemUpdate(); -- 1.7.9.5