Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
4537fe64
Commit
4537fe64
authored
20 years ago
by
rtoy
Browse files
Options
Downloads
Patches
Plain Diff
Add a few tests for read-sequence.
parent
9e16af0e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pcl/simple-streams/rt/simple-streams-test.lisp
+65
-0
65 additions, 0 deletions
pcl/simple-streams/rt/simple-streams-test.lisp
with
65 additions
and
0 deletions
pcl/simple-streams/rt/simple-streams-test.lisp
+
65
−
0
View file @
4537fe64
...
@@ -166,6 +166,24 @@
...
@@ -166,6 +166,24 @@
(
string=
content
seq
))))
(
string=
content
seq
))))
t
)
t
)
(
deftest
write-read-large-sc-read-seq-2
(
let*
((
stream
(
make-instance
'file-simple-stream
:filename
*test-file*
:direction
:output
:if-exists
:overwrite
:if-does-not-exist
:create
))
(
length
(
1+
(
*
3
(
device-buffer-length
stream
))))
(
content
(
make-string
length
)))
(
dotimes
(
i
(
length
content
))
(
setf
(
aref
content
i
)
(
code-char
(
random
256
))))
(
with-open-stream
(
s
stream
)
(
write-string
content
s
))
(
with-test-file
(
s
*test-file*
:class
'file-simple-stream
:direction
:input
:if-does-not-exist
:error
)
(
let
((
seq
(
make-string
length
)))
(
read-sequence
seq
s
)
(
string=
content
seq
))))
t
)
(
deftest
write-read-large-sc-3
(
deftest
write-read-large-sc-3
(
let*
((
stream
(
make-instance
'file-simple-stream
(
let*
((
stream
(
make-instance
'file-simple-stream
:filename
*test-file*
:direction
:output
:filename
*test-file*
:direction
:output
...
@@ -186,6 +204,24 @@
...
@@ -186,6 +204,24 @@
(
equalp
content
seq
))))
(
equalp
content
seq
))))
t
)
t
)
(
deftest
write-read-large-sc-read-seq-3
(
let*
((
stream
(
make-instance
'file-simple-stream
:filename
*test-file*
:direction
:output
:if-exists
:overwrite
:if-does-not-exist
:create
))
(
length
(
1+
(
*
3
(
device-buffer-length
stream
))))
(
content
(
make-array
length
:element-type
'
(
unsigned-byte
8
))))
(
dotimes
(
i
(
length
content
))
(
setf
(
aref
content
i
)
(
random
256
)))
(
with-open-stream
(
s
stream
)
(
write-sequence
content
s
))
(
with-test-file
(
s
*test-file*
:class
'file-simple-stream
:direction
:input
:if-does-not-exist
:error
)
(
let
((
seq
(
make-array
length
:element-type
'
(
unsigned-byte
8
))))
(
read-sequence
seq
s
)
(
equalp
content
seq
))))
t
)
(
deftest
write-read-large-dc-1
(
deftest
write-read-large-dc-1
;; Do write and read with more data than the buffer will hold
;; Do write and read with more data than the buffer will hold
;; (dual-channel simple-stream; we only have socket streams atm)
;; (dual-channel simple-stream; we only have socket streams atm)
...
@@ -346,3 +382,32 @@
...
@@ -346,3 +382,32 @@
(
equalp
uvector
result-uvector
)
(
equalp
uvector
result-uvector
)
(
equalp
svector
result-svector
)))
(
equalp
svector
result-svector
)))
T
)
T
)
(
deftest
create-read-mapped-file-read-seq-1
;; Read data via a mapped-file-simple-stream object using
;; read-sequence.
(
let
((
result
t
))
(
with-test-file
(
s
*test-file*
:class
'mapped-file-simple-stream
:direction
:input
:if-does-not-exist
:error
:initial-content
*dumb-string*
)
(
let
((
seq
(
make-string
(
length
*dumb-string*
))))
(
read-sequence
seq
s
)
(
setf
result
(
and
result
(
string=
seq
*dumb-string*
)))))
result
)
t
)
(
deftest
create-read-mapped-file-read-seq-2
;; Read data via a mapped-file-simple-stream object using
;; read-sequence.
(
let
((
result
t
))
(
with-test-file
(
s
*test-file*
:class
'mapped-file-simple-stream
:direction
:input
:if-does-not-exist
:error
:initial-content
*dumb-string*
)
(
let
((
seq
(
make-string
(
+
10
(
length
*dumb-string*
)))))
(
read-sequence
seq
s
)
(
setf
result
(
and
result
(
string=
seq
*dumb-string*
:end1
(
length
*dumb-string*
))))))
result
)
t
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment