mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 10:02:47 +03:00
commit
e394919094
@ -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)
|
||||
--
|
||||
|
@ -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
51
tests/sys/hoon/qeu.hoon
Normal 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])
|
||||
--
|
Loading…
Reference in New Issue
Block a user