Merge pull request #1132 from urbit/hotfix

Hotfix
This commit is contained in:
ixv 2019-04-03 11:03:49 -07:00 committed by GitHub
commit e394919094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 4 deletions

View File

@ -2098,7 +2098,7 @@
:: render circle (as glyph if we can).
?~ moy
=+ cha=(~(get by bound) one ~ ~)
=- ?~(cha - "{u.cha ~} {-}")
=- ?~(cha - "{u.cha ~}")
~(cr-phat cr one)
(~(cr-curt cr one) u.moy)
--

View File

@ -1875,9 +1875,10 @@
::
++ nap :: removes head
?> ?=(^ a)
?: =(~ l.a) r.a
=+ b=get(a l.a)
bal(a ^+(a [p.b q.b r.a]))
?~ a ~
=+ b=get
?~ q.b ~
bal(a ^+(a [n=n.q.b l=l.q.b r=r.q.b]))
::
++ put :: insert new tail
|* b/*

51
tests/sys/hoon/qeu.hoon Normal file
View File

@ -0,0 +1,51 @@
:: test a fix for a bug in +nap:to affecting three-item queues.
::
:: (see https://github.com/urbit/arvo/issues/1100 for details)
::
:: the test creates several queues from known lists and recursively
:: unqueues the top, comparing it with the current element of the list.
::
/+ *test
::
=/ descending ~[7 6 5 4 3 2 1]
=/ ascending ~[1 2 3 4 5 6 7]
=/ unsorted ~[1 6 3 5 7 2 4]
=/ duplicates ~[1 1 7 4 6 9 4]
::
=>
|%
++ unqueue
|= [queue=(qeu @) test=(list @)]
^- tang
%- zing
|- ^- (list tang)
?~ test ~
?~ queue ~
:_ $(queue ~(nap to queue), test t.test)
%+ expect-eq
!> (need ~(top to queue))
!> i.test
--
::
|%
::
++ test-descending-sorted-list ^- tang
::
=+ queue=(~(gas to `(qeu @)`~) descending)
(unqueue [queue descending])
::
++ test-ascending-sorted-list ^- tang
::
=+ queue=(~(gas to `(qeu @)`~) ascending)
(unqueue [queue ascending])
::
++ test-unsorted-list ^- tang
::
=+ queue=(~(gas to `(qeu @)`~) unsorted)
(unqueue [queue unsorted])
::
++ test-duplicates-list ^- tang
::
=+ queue=(~(gas to `(qeu @)`~) duplicates)
(unqueue [queue duplicates])
--