Esempio n. 1
0
#
#         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 and Get methods
#

db = GTM()

globalName = "^Capital"
setValue = "London"

db.set( globalName, setValue )

getValue = db.get( globalName )

print globalName, " = ", getValue

Esempio n. 2
0
#=========================================================================*/

# 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")
Esempio n. 3
0
from gtm import GTM

#
#  Test the Set, Get and Order methods
#

db = GTM()

#
#   Exercise the string API
#

globalName = '^Capital("US")'
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:
Esempio n. 4
0
#  Copyright OSEHRA
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  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 Set and Get methods
#

db = GTM()

db.set("^Capital", "London")

capital = db.get("^Capital")

print "Capital = ", capital
Esempio n. 5
0
#  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)
Esempio n. 6
0

# 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")
Esempio n. 7
0
#  Licensed under the Apache License, Version 2.0 (the "License");
#  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 Set and Get methods
#

db = GTM()

db.set("^Capital","London")

capital = db.get("^Capital")

print "Capital = ", capital