# http://www.apache.org/licenses/LICENSE-2.0.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #=========================================================================*/ # load gtm module from gtm import GTM # # Test the Set, Get and Kill methods # db = GTM() globalName = "^Capital" setValue = "London" db.set( globalName, setValue ) getValue = db.get( globalName ) print globalName, " = ", getValue db.kill( globalName )
# load gtm module from gtm import GTM db = GTM() print db.about() print db.version() getValue = "Initially empty" for k in xrange(1, 1000): db.set("^FibonacciA", "1") db.set("^FibonacciB", "1") termnumber = 100 for i in xrange(1, termnumber): db.execute("set ^FibonacciValue=^FibonacciA+^FibonacciB") db.execute("set ^FibonacciB=^FibonacciA") db.execute("set ^FibonacciA=^FibonacciValue") getValue = db.get("^FibonacciValue") print 'Fibonacci term ', termnumber, ' = ', getValue db.kill("^FibonacciA") db.kill("^FibonacciB") db.kill("^FibonacciValue")
setValue = 'Washington' db.set( globalName, setValue ) globalName = '^Capital("UK")' setValue = 'London' db.set( globalName, setValue ) getValue = db.order( globalName ) print "Order of ", globalName, " = ", getValue expectedValue = "US" db.kill('^Capital') if getValue != expectedValue: print "Test FAILED !" print "Expected value = ", expectedValue print "Received value = ", getValue sys.exit(1) # # Exercise the same pattern with direct strings # db.set( '^Capital("US")', 'Washington' ) db.set( '^Capital("UK")', 'London' )
# you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0.txt # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #=========================================================================*/ # load gtm module from gtm import GTM # # Test the Lock method # db = GTM() globalName = '^Capital("US")' setValue = 'Washington' db.lock(globalName) db.set(globalName, setValue) db.kill(globalName)
# load gtm module from gtm import GTM db = GTM() print db.about() print db.version() getValue = "Initially empty" for k in xrange(1,1000): db.set("^FibonacciA", "1") db.set("^FibonacciB", "1") termnumber = 100 for i in xrange(1,termnumber): db.execute("set ^FibonacciValue=^FibonacciA+^FibonacciB") db.execute("set ^FibonacciB=^FibonacciA") db.execute("set ^FibonacciA=^FibonacciValue") getValue = db.get("^FibonacciValue") print 'Fibonacci term ', termnumber, ' = ', getValue db.kill("^FibonacciA") db.kill("^FibonacciB") db.kill("^FibonacciValue")
# #=========================================================================*/ # load gtm module from gtm import GTM # # Test the Lock method # db = GTM() globalName = "^ValueCounter" setValue = "0" getValue = "Initially empty" db.lock( globalName ) db.set( globalName, setValue ) for i in xrange(0,9): db.execute("set ^ValueCounter=^ValueCounter+1") getValue = db.get( globalName ) print "counter = ", getValue print "Final Counter Value = ", getValue db.kill( "^ValueCounter" )
# See the License for the specific language governing permissions and # limitations under the License. # #=========================================================================*/ # load gtm module from gtm import GTM # # Test the Lock method # db = GTM() globalName = "^ValueCounter" setValue = "0" getValue = "Initially empty" db.lock(globalName) db.set(globalName, setValue) for i in xrange(0, 9): db.execute("set ^ValueCounter=^ValueCounter+1") getValue = db.get(globalName) print "counter = ", getValue print "Final Counter Value = ", getValue db.kill("^ValueCounter")