Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl-copy
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
Richard M Kreuter
cmucl-copy
Commits
0f0ac0b6
Commit
0f0ac0b6
authored
6 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Add tests with fixed operands
parent
01fa37d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/bignum.lisp
+39
-1
39 additions, 1 deletion
tests/bignum.lisp
with
39 additions
and
1 deletion
tests/bignum.lisp
+
39
−
1
View file @
0f0ac0b6
...
...
@@ -5,9 +5,47 @@
(
in-package
#:bignum-tests
)
(
define-test
hd-mult
(
define-test
hd-mult
.same-size
"Test bignum multiplier"
(
:tag
:bignum-tests
)
;; x and y are randomly generated 128 integers. No particular reason
;; for these values, except that they're bignums.
(
let
((
x
248090201001762284446997112921270181259
)
(
y
313102667534462314033767199170708979663
)
(
prod
77677703722812705876871716049945873590003455155145426220435549433670954735717
))
;; Verify the we get the right results for various signed values of x and y.
(
assert-equal
prod
(
*
x
y
))
(
assert-equal
(
-
prod
)
(
*
(
-
x
)
y
))
(
assert-equal
(
-
prod
)
(
*
x
(
-
y
)))
(
assert-equal
prod
(
*
(
-
x
)
(
-
y
)))
;; Nake sure it's commutative
(
assert-equal
prod
(
*
y
x
))
(
assert-equal
(
-
prod
)
(
*
y
(
-
x
)))
(
assert-equal
(
-
prod
)
(
*
(
-
y
)
x
))
(
assert-equal
prod
(
*
(
-
y
)
(
-
x
)))))
(
define-test
hd-mult.diff-size
"Test bignum multiplier"
(
:tag
:bignum-tests
)
;; x is a randomly generated bignum. y is a small bignum.
(
let
((
x
248090201001762284446997112921270181259
)
(
y
(
1+
most-positive-fixnum
))
(
prod
133192412470079431258262755675409306410924638208
))
;; Verify the we get the right results for various signed values of x and y.
(
assert-equal
prod
(
*
x
y
))
(
assert-equal
(
-
prod
)
(
*
(
-
x
)
y
))
(
assert-equal
(
-
prod
)
(
*
x
(
-
y
)))
(
assert-equal
prod
(
*
(
-
x
)
(
-
y
)))
;; Nake sure it's commutative
(
assert-equal
prod
(
*
y
x
))
(
assert-equal
(
-
prod
)
(
*
y
(
-
x
)))
(
assert-equal
(
-
prod
)
(
*
(
-
y
)
x
))
(
assert-equal
prod
(
*
(
-
y
)
(
-
x
)))))
(
define-test
hd-mult.random
"Test bignum multiplier with random values"
(
:tag
:bignum-tests
)
(
let
((
rng
(
kernel::make-random-object
:state
(
kernel:init-random-state
)
:rand
0
:cached-p
nil
))
...
...
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