Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
noVNC
Commits
4ff85f49
Commit
4ff85f49
authored
Aug 26, 2010
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test both builtin and base64.js functions.
parent
67b4e987
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
base64.html
tests/base64.html
+23
-7
No files found.
tests/base64.html
View file @
4ff85f49
...
...
@@ -3,6 +3,7 @@
<head>
<title>
Native Base64 Tests
</title>
<script
src=
"include/util.js"
></script>
<script
src=
"include/base64.js"
></script>
</head>
<body>
<h1>
Native Base64 Tests
</h1>
...
...
@@ -40,19 +41,19 @@
return
true
;
}
function
Base64_decode
(
data
)
{
var
arr
=
Base64
.
decode
(
data
);
return
arr
.
map
(
function
(
num
)
{
return
String
.
fromCharCode
(
num
);
}
).
join
(
''
);
}
window
.
onload
=
function
()
{
var
str
;
debug
(
'onload'
);
fail
=
0
;
pass
=
0
;
assertRun
(
'window.btoa("hello world")'
,
'aGVsbG8gd29ybGQ='
);
assertRun
(
'window.atob("aGVsbG8gd29ybGQ=")'
,
'hello world'
);
assertRun
(
'window.atob("YQ==")'
,
'a'
);
assertRun
(
'window.atob("YWI=")'
,
'ab'
);
assertRun
(
'window.atob("YWJj")'
,
'abc'
);
assertRun
(
'window.atob("YWJjZA==")'
,
'abcd'
);
assertRun
(
'window.atob("YWJjZGU=")'
,
'abcde'
);
assertRun
(
'window.atob("YWJjZGVm")'
,
'abcdef'
);
assertRun
(
'window.btoa("a")'
,
'YQ=='
);
assertRun
(
'window.btoa("ab")'
,
'YWI='
);
assertRun
(
'window.btoa("abc")'
,
'YWJj'
);
...
...
@@ -62,6 +63,21 @@
assertRun
(
'window.btoa("abcdefg")'
,
'YWJjZGVmZw=='
);
assertRun
(
'window.btoa("abcdefgh")'
,
'YWJjZGVmZ2g='
);
assertRun
(
'window.atob("aGVsbG8gd29ybGQ=")'
,
'hello world'
);
assertRun
(
'Base64_decode("aGVsbG8gd29ybGQ=")'
,
'hello world'
);
assertRun
(
'window.atob("YQ==")'
,
'a'
);
assertRun
(
'Base64_decode("YQ==")'
,
'a'
);
assertRun
(
'window.atob("YWI=")'
,
'ab'
);
assertRun
(
'Base64_decode("YWI=")'
,
'ab'
);
assertRun
(
'window.atob("YWJj")'
,
'abc'
);
assertRun
(
'Base64_decode("YWJj")'
,
'abc'
);
assertRun
(
'window.atob("YWJjZA==")'
,
'abcd'
);
assertRun
(
'Base64_decode("YWJjZA==")'
,
'abcd'
);
assertRun
(
'window.atob("YWJjZGU=")'
,
'abcde'
);
assertRun
(
'Base64_decode("YWJjZGU=")'
,
'abcde'
);
assertRun
(
'window.atob("YWJjZGVm")'
,
'abcdef'
);
assertRun
(
'Base64_decode("YWJjZGVm")'
,
'abcdef'
);
assertRun
(
'typeof window.btoa'
,
'function'
);
assertRun
(
'window.btoa("")'
,
''
);
assertRun
(
'window.btoa(null)'
,
''
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment