|
||||||
| SUMMARY: CHILDREN | PARAMETER | INSTPROC | INSTFILTER | INSTFORWARD | DETAIL: | INSTPROC | |||||
::xotcl::Object
|
+--::xox::Node
|
+--::xounit::Test
|
+--::xounit::Assert
|
+--::xounit::TestCase
| Variables | |||
| Name | Default Value | Class | Comment |
currentTestMethod |
::xounit::TestCase | name of the currently running test method. |
|
nodeName |
::xox::Node | ||
result |
::xounit::TestCase | the result for the current run. |
|
| Methods | |
| Name | Comment |
notestLoggingAndTracing {}
| |
notestScaleMixin {}
| |
notestScaleNoLog {}
| |
notestScaleObject {}
| |
notestScaleWrongClass {}
| |
notestScaleWrongLevel {}
| |
tearDown {}
| tearDown is called after each test method in your specific test case |
testCheckLogClass {}
| |
testExists {}
| |
testLevelHierachy {}
| |
testLog {}
| |
testLogging {}
| |
testLogging2 {}
| |
testSetLogClass {}
| |
testSetLogLevel {}
| |
| Methods from ::xotcl::Object |
#, ., ?, ?code, ?methods, ?object, abstract, copy, coverageFilter, defaultmethod, extractConfigureArg, filterappend, garbageCollect, get#, getClean#, hasclass, init, methodTag, mixinappend, move, profileFilter, self, setParameterDefaults, shell, tclcmd, traceFilter,
|
| Instproc Detail |
::xox::test::TestLogger instproc notestLoggingAndTracing {} {
Class ::xox::test::LoggerTestClass
set o [ ::xox::test::LoggerTestClass new ]
$o mixin ::xox::Logging
::xox::Logger addLogClass ::xotcl::Object
::xox::Logger setLogLevel debug
::xox::Trace add ::xox::test::LoggerTestClass
$o set a 5
$o log debug hey
::xox::Trace remove ::xotcl::Object
}
::xox::test::TestLogger instproc notestScaleMixin {} {
set o [ ::xotcl::Object new ]
::xox::Logger addLogClass ::xotcl::Object
::xox::Logger setLogLevel debug
$o mixin ::xox::Logging
set start [ clock clicks -milliseconds ]
for { set loop 0 } { $loop < 1000000 } { incr loop } {
$o set a 5
}
set end [ clock clicks -milliseconds ]
set time [ expr { $end - $start } ]
my assert [ expr { $time < 2000 } ] "$time"
}
::xox::test::TestLogger instproc notestScaleNoLog {} {
set o [ ::xotcl::Object new ]
#::xox::Logger addLogClass ::xotcl::Object
#::xox::Logger setLogLevel debug
$o mixin ::xox::Logging
set start [ clock clicks -milliseconds ]
for { set loop 0 } { $loop < 1000000 } { incr loop } {
$o log debug hey
}
set end [ clock clicks -milliseconds ]
set time [ expr { $end - $start } ]
#assert less than 20 micro seconds
#for turned off
my assert [ expr { $time < 20000 } ] "Too slow: $time"
}
::xox::test::TestLogger instproc notestScaleObject {} {
set o [ ::xotcl::Object new ]
#::xox::Logger addLogClass ::xotcl::Object
#::xox::Logger setLogLevel debug
#$o mixin ::xox::Logging
set start [ clock clicks -milliseconds ]
for { set loop 0 } { $loop < 1000000 } { incr loop } {
$o set a 5
}
set end [ clock clicks -milliseconds ]
set time [ expr { $end - $start } ]
my assert [ expr { $time < 2000 } ] "$time"
}
::xox::test::TestLogger instproc notestScaleWrongClass {} {
set o [ ::xotcl::Object new ]
::xox::Logger addLogClass ::xounit::Test
#::xox::Logger setLogLevel debug
$o mixin ::xox::Logging
set start [ clock clicks -milliseconds ]
for { set loop 0 } { $loop < 1000000 } { incr loop } {
$o log debug hey
}
set end [ clock clicks -milliseconds ]
set time [ expr { $end - $start } ]
#assert less than 20 micro seconds
#for turned off
my assert [ expr { $time < 20000 } ] "Too slow: $time"
}
::xox::test::TestLogger instproc notestScaleWrongLevel {} {
set o [ ::xotcl::Object new ]
::xox::Logger addLogClass ::xotcl::Object
::xox::Logger setLogLevel warn
$o mixin ::xox::Logging
set start [ clock clicks -milliseconds ]
for { set loop 0 } { $loop < 1000000 } { incr loop } {
$o log debug hey
}
set end [ clock clicks -milliseconds ]
set time [ expr { $end - $start } ]
#assert less than 20 micro seconds
#for turned off
my assert [ expr { $time < 20000 } ] "Too slow: $time"
}
tearDown is called after each test method in your specific test case. This allows you to clean up any resources that were used in your test methods. Override this method in your TestCase and it will automatically called after each test method.
::xox::test::TestLogger instproc tearDown {} {
::xox::Logger setLogLevel critical
catch { ::xox::Logger unset logClasses }
}
::xox::test::TestLogger instproc testCheckLogClass {} {
::xox::Logger setLogLevel debug
set level debug
set level "::xox::log::${level}"
my assert [ $level hasclass [ ::xox::Logger logLevel ] ]
set level critical
set level "::xox::log::${level}"
my assert [ $level hasclass [ ::xox::Logger logLevel ] ]
::xox::Logger setLogLevel warn
set level critical
set level "::xox::log::${level}"
my assert [ $level hasclass [ ::xox::Logger logLevel ] ]
set level debug
set level "::xox::log::${level}"
my assertFalse [ $level hasclass [ ::xox::Logger logLevel ] ]
}
::xox::test::TestLogger instproc testExists {} {
my assertObject ::xox::Logger
my assert [ Object isclass ::xox::LogDebug ]
my assert [ Object isclass ::xox::LogInfo ]
my assert [ Object isclass ::xox::LogNotice ]
my assert [ Object isclass ::xox::LogWarn ]
my assert [ Object isclass ::xox::LogError ]
my assert [ Object isclass ::xox::LogCritical ]
my assert [ Object isobject ::xox::log::debug ]
my assert [ Object isobject ::xox::log::info ]
my assert [ Object isobject ::xox::log::notice ]
my assert [ Object isobject ::xox::log::warn ]
my assert [ Object isobject ::xox::log::error ]
my assert [ Object isobject ::xox::log::critical ]
}
::xox::test::TestLogger instproc testLevelHierachy {} {
my assert [ ::xox::log::critical hasclass ::xox::LogCritical ]
my assert [ ::xox::log::critical hasclass ::xox::LogDebug ]
my assertFalse [ ::xox::log::error hasclass ::xox::LogCritical ]
my assert [ ::xox::log::error hasclass ::xox::LogError ]
my assert [ ::xox::log::error hasclass ::xox::LogDebug ]
my assert [ ::xox::log::warn hasclass ::xox::LogWarn ]
my assert [ ::xox::log::warn hasclass ::xox::LogDebug ]
my assert [ ::xox::log::notice hasclass ::xox::LogNotice ]
my assert [ ::xox::log::notice hasclass ::xox::LogDebug ]
my assert [ ::xox::log::info hasclass ::xox::LogInfo ]
my assert [ ::xox::log::info hasclass ::xox::LogDebug ]
my assert [ ::xox::log::debug hasclass ::xox::LogDebug ]
}
::xox::test::TestLogger instproc testLog {} {
::xox::Logger addLogClass ::xotcl::Object
::xox::Logger setLogLevel debug
set o [ ::xotcl::Object new ]
::xox::Logger log $o ::xotcl::Object something debug hey
}
::xox::test::TestLogger instproc testLogging {} {
::xox::Logger addLogClass ::xotcl::Object
::xox::Logger setLogLevel debug
set o [ ::xotcl::Object new ]
$o mixin ::xox::Logging
$o log debug hey
$o log info hi
$o log notice log
$o log warn "oh no!"
$o log error "argg!"
$o log critical "im dead"
::xox::Logger setLogLevel warn
$o log debug debug
$o log info info
$o log notice notice
$o log warn warn
$o log error error
$o log critical critical
}
::xox::test::TestLogger instproc testLogging2 {} {
::xox::Logger addLogClass ::xotcl::Object
::xox::Logger setLogLevel debug
set o [ ::xox::Logging new ]
$o log debug hey
$o log info hi
$o log notice log
$o log warn "oh no!"
$o log error "argg!"
$o log critical "im dead"
::xox::Logger setLogLevel warn
$o log debug debug
$o log info info
$o log notice notice
$o log warn warn
$o log error error
$o log critical critical
}
::xox::test::TestLogger instproc testSetLogClass {} {
::xox::Logger addLogClass ::xotcl::Object
my assertEquals [ ::xox::Logger logClasses ] ::xotcl::Object
}
::xox::test::TestLogger instproc testSetLogLevel {} {
::xox::Logger setLogLevel debug
my assertEquals [ ::xox::Logger logLevel ] ::xox::LogDebug
::xox::Logger setLogLevel info
my assertEquals [ ::xox::Logger logLevel ] ::xox::LogInfo
::xox::Logger setLogLevel notice
my assertEquals [ ::xox::Logger logLevel ] ::xox::LogNotice
::xox::Logger setLogLevel warn
my assertEquals [ ::xox::Logger logLevel ] ::xox::LogWarn
::xox::Logger setLogLevel error
my assertEquals [ ::xox::Logger logLevel ] ::xox::LogError
::xox::Logger setLogLevel critical
my assertEquals [ ::xox::Logger logLevel ] ::xox::LogCritical
}