class StringT issubclassof TestDriver functions public tests : () -> seqof TestCase
tests () ==
[ new StringT01(), new StringT02(), new StringT03(), new StringT04(), new StringT05(), new StringT06(), new StringT07(), new StringT08(), new StringT09(), -- new StringT10(), new StringT11(), new StringT12(), new StringT13(), new StringT14()
]; end StringT
class StringT01 issubclassof TestCase operations protected test: () ==> bool
test() == let c = new Character() in return
(
c.isDigit('0') = trueand
c.isDigit('1') = trueand
c.isDigit('2') = trueand
c.isDigit('3') = trueand
c.isDigit('4') = trueand
c.isDigit('5') = trueand
c.isDigit('6') = trueand
c.isDigit('7') = trueand
c.isDigit('8') = trueand
c.isDigit('9') = trueand
c.isDigit('a') = falseand
c.asDigit('0') = 0 and
c.asDigit('1') = 1 and
c.asDigit('2') = 2 and
c.asDigit('3') = 3 and
c.asDigit('4') = 4 and
c.asDigit('5') = 5 and
c.asDigit('6') = 6 and
c.asDigit('7') = 7 and
c.asDigit('8') = 8 and
c.asDigit('9') = 9 and
c.asDigit('a') = false )
; protected setUp: () ==> ()
setUp() == TestName := "StringT01:\tConvert digit to integer."; protected tearDown: () ==> ()
tearDown() == return; end StringT01
class StringT02 issubclassof TestCase operations protected test: () ==> bool
test() == let c = new Character() in return
(c.asDictOrder('0') = 1 and
c.asDictOrder('9') = 10 and
c.asDictOrder('a') = 11 and
c.asDictOrder('A') = 12 and
c.asDictOrder('z') = 61 and
c.asDictOrder('Z') = 62 and
c.asDictOrder('\n') = 999999 and
c.asDictOrder('\t') = 999999 )
; protected setUp: () ==> ()
setUp() == TestName := "StringT02:\tReturn dictionary order of character."; protected tearDown: () ==> ()
tearDown() == return; end StringT02
class StringT03 issubclassof TestCase operations protected test: () ==> bool
test() == let s = new String(),
LT = String`LT2,
LE = String`LE2,
GT = String`GT2,
GE = String`GE2 in return
(s.LT("123","123") = falseand
LT("123")("123") = falseand
s.GT("123","123") = falseand
GT("123")( "123") = falseand
s.LT("","") = falseand
s.GT("","") = falseand
s.LT("","123") = trueand
s.GT("","123") = falseand
s.LT("123","") = falseand
s.GT("123","") and
s.LT("123","1234") and
s.GT("123","1234") = falseand
s.LT("1234","123") = falseand
s.GT("1234","123") and
s.LT("123","223") and
s.GT("123","223") = falseand
s.LE("123","123") and
LE("123")("123") and
s.GE("123","123") and
s.LE("123","1234") and
LE("123")("1234") and
s.GE("123","1234") = falseand
GE("123")("1234") = falseand
s.LE("1234","123") = falseand not LE("1234")("123") and
s.GE("1234","123") and
s.LE("","") and
LE("")("") and
Sequence`fmap[seqofchar, bool](LT("123"))(["123", "1234", "", "223"]) = [false, true, false, true] and
Sequence`fmap[seqofchar, bool](LE("123"))(["1234", ""]) = [true, false] and
Sequence`fmap[seqofchar, bool](GT("123"))([ "123", "", "23"]) = [false, true, false] and
Sequence`fmap[seqofchar, bool](GE("123"))(["1234", ""]) = [false, true]
)
; protected setUp: () ==> ()
setUp() == TestName := "StringT03:\tCompare magnitude of string."; protected tearDown: () ==> ()
tearDown() == return; end StringT03
class StringT04 issubclassof TestCase operations protected test: () ==> bool
test() == let s1234 = "1234",
s = new String() in return
s1234 = "1234"and
s.isSpaces("") = trueand
s.isSpaces(" ") = trueand
s.isSpaces(" \t ") = trueand
s.isSpaces([]) = true
; protected setUp: () ==> ()
setUp() == TestName := "StringT04:\tCompare 2 strings is equal."; protected tearDown: () ==> ()
tearDown() == return; end StringT04
class StringT05 issubclassof TestCase operations protected test: () ==> bool
test() == let LT = Character`LT,
GT = Character`GT,
LE = Character`LE,
GE = Character`GE in return
(LT('a','a') = falseand
Character`LT2('a')('a') = falseand
GT('a','a') = falseand
Character`GT2('a')('a') = falseand
LT('1','2') and
Character`LT2('1')('2') and
GT('1','0') and
Character`GT2('1')('0') and
LT('9','a') and
Character`LT2('9')('a') and
GT('\n','0') and
Character`GT2('\n')('0') and
LE('a','0') = falseand
Character`LE2('a')('0') = falseand
GE('a','0') and
Character`GE2('a')('0') and
Sequence`fmap[char, bool](Character`LT2('5'))("456") = [false, false, true]
)
; protected setUp: () ==> ()
setUp() == TestName := "StringT05:\tCompare magnitude of character."; protected tearDown: () ==> ()
tearDown() == return; end StringT05
class StringT08 issubclassof TestCase operations protected test: () ==> bool
test() == return
(
String`index("1234567890",'1') = 1 and
String`index("1234567890",'0') = 10 and
String`index("1234567890",'a') = 0 and
String`indexAll("1234567890",'1') = {1} and
String`indexAll("1234567890",'0') = {10} and
String`indexAll("1234567890",'a') = {} and
String`indexAll("1231567190",'1') = {1,4,8} and
String`indexAll("1231567191",'1') = {1,4,8,10} and
String`Index('1')("1234567890") = 1 and
String`Index('0')("1234567890") = 10 and
String`Index('a')("1234567890") = 0 and
String`IndexAll2('1')("1234567890") = {1} and
String`IndexAll2('0')("1234567890") = {10} and
String`IndexAll2('a')("1234567890") = {} and
String`IndexAll2('1')("1231567190") = {1,4,8} and
String`IndexAll2('1')("1231567191") = {1,4,8,10} and
Sequence`fmap[seqofchar, int](String`Index('1'))(["1234567890", "2345671"]) = [1, 7] and
Sequence`fmap[seqofchar, setofint](String`IndexAll2('1'))(["1231567190", "1231567191"]) = [{1,4,8}, {1,4,8,10}]
)
; protected setUp: () ==> ()
setUp() == TestName := "StringT08:\tGet first position of a character in a string."; protected tearDown: () ==> ()
tearDown() == return; end StringT08
class StringT09 issubclassof TestCase operations protected test: () ==> bool
test() == let isInclude = String`isInclude in return
(String`isInclude("1234567890")( "abc") = falseand
isInclude("Shin")("Shin") = trueand
isInclude("Shin")("S") = trueand
isInclude("Shin")("h") = trueand
isInclude("Shin")("n") = true
)
; protected setUp: () ==> ()
setUp() == TestName := "StringT09:\tIs a string the substring of another string."; protected tearDown: () ==> ()
tearDown() == return; end StringT09
class StringT10 issubclassof TestCase operations protected test: () ==> bool
test() == tixe {<RuntimeError> |-> returntrue } in return String`isInclude("Shin Sahara")("")
; protected setUp: () ==> ()
setUp() == TestName := "StringT10:\tIs a string the substring of another string. In case of pre-condition error"; protected tearDown: () ==> ()
tearDown() == return; end StringT10
/* シナリオID 英数字か判定するシナリオ 内容 英数字か判定が正しいかを検査する。
*/ class StringT13 issubclassof TestCase operations public test: () ==> bool
test() == return let w英字列 = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ",
w数字列 = "0123456789",
w英数字列 = w英字列 ^ w数字列 in
String`isLetters(w英字列) and not String`isLetters(" " ^ w英字列) and
String`isDigits(w数字列) and not String`isDigits(" " ^ w数字列) and not String`isDigits("a" ^ w数字列) and
String`isLetterOrDigits(w英数字列) and not String`isLetterOrDigits(w英数字列 ^ " ")
; protected setUp: () ==> ()
setUp() == TestName := "StringT13:\t英数字かの判定が正しいかを検査する。"; protected tearDown: () ==> ()
tearDown() == return; end StringT13
class StringT14 issubclassof TestCase operations protected test: () ==> bool
test() == let isSomeString = String`isSomeString inreturn
isSomeString(Character`isLetterOrDigit)("007isTheMmurder") and not isSomeString(Character`isLetterOrDigit)("007 is the mmurder") and
isSomeString(Character`isCapitalLetter)("SAHARA") and not isSomeString(Character`isCapitalLetter)("Sahara") and
isSomeString(Character`isLowercaseLetter)("sahara") and not isSomeString(Character`isLowercaseLetter)("Sahara")
; protected setUp: () ==> ()
setUp() == TestName := "StringT11:\tIs a some kind of string?"; protected tearDown: () ==> ()
tearDown() == return; end StringT14
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.