FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
livecode/tests/_inputlib.livecodescript at develop · livecode/livecode · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
livecode
/
livecode
Public archive
Notifications
You must be signed in to change notification settings
Fork
223
Star
517
Code
Pull requests
189
Actions
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
livecode
/
tests
/
_inputlib.livecodescript
Copy path
More file actions
More file actions
Latest commit
History
History
History
168 lines (130 loc) · 5.01 KB
Breadcrumbs
livecode
/
tests
/
_inputlib.livecodescript
Copy path
File metadata and controls
168 lines (130 loc) · 5.01 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
script
"testInputLibrary
"
/*
Copyright (C) 2015 LiveCode Ltd.
This file is part of LiveCode.
LiveCode is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License v3 as published by the Free
Software Foundation.
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LiveCode. If not see <http://www.gnu.org/licenses/>.
*/
on
revLoadLibrary
if
the
target
is not
me
then
pass revLoadLibrary
end if
insert
the
script
of
me
into
back
end
revLoadLibrary
local
sTestStrings
,
sTestNumbers
,
sTestConversionStrings
,
sTestFilePaths
,
sArrayData
local
sInitialised
function
TestGetInputFilesFolder
set
the
itemDelimiter
to
slash
return
item
1
to
-
2
of
the
filename
of
me
&
slash
&
"lcs-input-files"
end
TestGetInputFilesFolder
private
function
getTestFile
pTestFile
local
tContent
,
tFilePath
put
TestGetInputFilesFolder()
&
slash
&
pTestFile
into
tFilePath
//
test files are written without BOM
open
file
tFilePath
for
"utf8"
text
read
read from file
tFilePath
until
EOF
put
it
into
tContent
close file
tFilePath
return
tContent
end
getTestFile
on
setUpValues
if
sInitialised
then
exit setUpValues
end if
put
true
into
sInitialised
//
load in strings
local
tStrings
put
getTestFile(
"testStrings.txt"
)
into
tStrings
put
empty
into
sArrayData
local
tFirstLine
put
line
1
of
tStrings
into
tFirstLine
delete line
1
of
tStrings
repeat
for
each
line
tLine
in
tStrings
local
tType
,
tNumber
put
item
1
of
tLine
into
tType
put
item
2
of
tLine
into
tNumber
put
item
3
of
tLine
into
sTestStrings
[
tType
][
tNumber
][
item
3
of
tFirstLine
]
put
item
4
of
tLine
into
sTestStrings
[
tType
][
tNumber
][
item
4
of
tFirstLine
]
put
item
5
of
tLine
into
sTestStrings
[
tType
][
tNumber
][
item
5
of
tFirstLine
]
put
item
6
of
tLine
into
sTestStrings
[
tType
][
tNumber
][
item
6
of
tFirstLine
]
end repeat
//
load in numbers
local
tNumbers
put
getTestFile(
"testNumbers.txt"
)
into
tNumbers
repeat
for
each
line
tLine
in
tNumbers
put
item
2
of
tLine
into
sTestNumbers
[
item
1
of
tLine
][
1
]
put
item
3
of
tLine
into
sTestNumbers
[
item
1
of
tLine
][
2
]
end repeat
//
Load in conversion strings
local
tConversionStrings
put
getTestFile(
"testConversionStrings.txt"
)
into
tConversionStrings
repeat
for
each
line
tLine
in
tConversionStrings
put
item
2
of
tLine
into
sTestConversionStrings
[
item
1
of
tLine
][
"lowerCase"
]
put
item
3
of
tLine
into
sTestConversionStrings
[
item
1
of
tLine
][
"upperCase"
]
put
item
4
of
tLine
into
sTestConversionStrings
[
item
1
of
tLine
][
"lowerCaseNumber"
]
put
item
5
of
tLine
into
sTestConversionStrings
[
item
1
of
tLine
][
"upperCaseNumber"
]
put
item
6
of
tLine
into
sTestConversionStrings
[
item
1
of
tLine
][
"lowerCaseByte"
]
put
item
7
of
tLine
into
sTestConversionStrings
[
item
1
of
tLine
][
"upperCaseByte"
]
end repeat
//
Load in file paths
local
tFilePaths
put
getTestFile(
"testFilePaths.txt"
)
into
tFilePaths
repeat
for
each
line
tLine
in
tFilePaths
put
item
2
of
tLine
into
sTestFilePaths
[
item
1
of
tLine
]
end repeat
//
Load in array data
local
tArrayData
put
getTestFile(
"testArrayData.txt"
)
into
tArrayData
repeat
for
each
line
tLine
in
tArrayData
put
item
2
to
-
1
of
tLine
into
sArrayData
[
item
1
of
tLine
]
end repeat
end
setUpValues
function
testString
pType
,
pNumber
,
pValue
setupValues
if
pValue
is
empty
then
put
"string"
into
pValue
put
"String:"
&&
pType
,
pNumber
,
pValue
&&
sTestStrings
[
pType
][
pNumber
][
pValue
]
&
return
after
url (
"binfile:"
&
specialFolderPath
(
"desktop"
)
&
"/log.txt"
)
return
sTestStrings
[
pType
][
pNumber
][
pValue
]
end
testString
function
testNumber
pType
,
pNumber
setupValues
return
sTestNumbers
[
pType
][
pNumber
]
end
testNumber
function
testConversionString
pStringType, pConversionType
setupValues
return
sTestConversionStrings
[
pStringType
][
pConversionType
]
end
testConversionString
function
testFilePath
pType
setupValues
return
sTestFilePaths
[
pType
]
end
testFilePath
function
testFolderList
setupValues
local
tFileList
repeat
for
each
element
tFile
in
sTestFilePaths
put
tFile
&
return
after
tFileList
end repeat
delete
the
last
character
of
tFileList
return
tFileList
end
testFolderList
function
testFileList
setupValues
local
tFileList
repeat
for
each
element
tFile
in
sTestFilePaths
put
tFile
&
".txt"
&
return
after
tFileList
end repeat
delete
the
last
character
of
tFileList
return
tFileList
end
testFileList
function
testArrayData
pKey
setupValues
return
sArrayData
[
pKey
]
end
testArrayData
function
TestGetInputFile
pFilename
return TestGetInputFilesFolder()
&
slash
&
pFilename
end
TestGetInputFile
Back
|
FazBrowse Home
|
New Git URL