⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 toaster.test

📁 linux 下的源代码分析阅读器 red hat公司新版
💻 TEST
字号:
## Tests for "toaster" example# ----------------------------------------------------------------------#   AUTHOR:  Michael J. McLennan#            Bell Labs Innovations for Lucent Technologies#            mmclennan@lucent.com#            http://www.tcltk.com/itcl##      RCS:  $Id: toaster.test 144 2003-02-05 10:56:26Z mdejong $# ----------------------------------------------------------------------#            Copyright (c) 1993-1998  Lucent Technologies, Inc.# ======================================================================# See the file "license.terms" for information on usage and# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.# ----------------------------------------------------------------------#  Get toaster classes from "demos" directory.# ----------------------------------------------------------------------lappend auto_path toasters# ----------------------------------------------------------------------#  Outlets send bills to an e-mail address.  Determine this address.# ----------------------------------------------------------------------if {[info exists env(USER)]} {	set Owner $env(USER)} elseif {[info exists env(LOGNAME)]} {	set Owner $env(LOGNAME)} else {	set Owner [exec logname]}# ----------------------------------------------------------------------#  TOASTERS# ----------------------------------------------------------------------test {Create a toaster and plug it in} {	global Owner	Toaster original -heat 1 -outlet [Outlet #auto -owner $Owner]} {	$result == "original"}test {Turn up the heat setting on the toaster} {	original config -heat 5} {	$result == ""}test {Toast a few slices of bread} {	original toast 2} {	$result == "crumb tray: 25% full"}test {Clean the toaster} {	original clean} {	$result == "crumb tray: 0% full"}test {Toast a few slices of bread a few different times} {	original clean	original toast 2	original toast 1} {	$result == "crumb tray: 38% full"}test {Toast too many slices of bread and cause a fire} {	puts stdout ">>> should say \"== FIRE! FIRE! ==\""	original clean	original toast 2	original toast 2	original toast 2	original toast 2} {	$result == "crumb tray: 100% full"}test {Destroy the toaster} {	original clean	original toast 2	original toast 1	puts stdout ">>> should say \"15 crumbs ... what a mess!\""	original delete} {	$result == ""}# ----------------------------------------------------------------------#  SMART TOASTERS# ----------------------------------------------------------------------test {Create a toaster and plug it in} {	global Owner	SmartToaster deluxe -heat 4 -outlet [Outlet #auto -owner $Owner]} {	$result == "deluxe"}test {Toast a few slices of bread} {	deluxe toast 2} {	$result == "crumb tray: 20% full"}test {Toast a few slices of bread and look for auto-clean} {	deluxe clean	deluxe toast 2	deluxe toast 2	deluxe toast 2	deluxe toast 2	deluxe toast 2} {	$result == "crumb tray: 20% full"}# ----------------------------------------------------------------------#  PRODUCT STATISTICS# ----------------------------------------------------------------------test {Check statistics gathered by Hazard base class} {	set tmp [Toaster #auto]	set stats [Hazard :: report ::Toaster]	$tmp delete	set stats} {	$result == "::Toaster: 2 produced, 1 active, 1 accidents"}test {Check statistics gathered by Hazard base class} {	Hazard :: report ::SmartToaster} {	$result == "::SmartToaster: 1 produced, 1 active, 0 accidents"}test {Destroy all Toasters} {	foreach toaster [itcl_info objects -isa Toaster] {		$toaster clean		$toaster delete	}} {	$result == ""}test {SmartToasters should have been destroyed along with Toasters} {	itcl_info objects -class SmartToaster} {	$result == ""}# ----------------------------------------------------------------------#  OUTLETS# ----------------------------------------------------------------------test {Bill all customers for outlet charges} {	Outlet :: bill	puts stdout ">>> should send two bills for outlets via e-mail"} {	$result == ""}test {Destroy all outlets} {	foreach outlet [itcl_info objects -class Outlet] {		$outlet delete	}} {	$result == ""}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -