mirror of
https://github.com/urbit/shrub.git
synced 2024-12-20 01:01:37 +03:00
Revert "test: move _test_lily into noun_tests"
This reverts commit 5825cbde71
.
This commit is contained in:
parent
dbda9ed30c
commit
8946164b96
68
pkg/urbit/tests/boot_tests.c
Normal file
68
pkg/urbit/tests/boot_tests.c
Normal file
@ -0,0 +1,68 @@
|
||||
#include "all.h"
|
||||
#include "ur/ur.h"
|
||||
#include "vere/ivory.h"
|
||||
#include "vere/vere.h"
|
||||
|
||||
/* _setup(): prepare for tests.
|
||||
*/
|
||||
static void
|
||||
_setup(void)
|
||||
{
|
||||
c3_d len_d = u3_Ivory_pill_len;
|
||||
c3_y* byt_y = u3_Ivory_pill;
|
||||
u3_cue_xeno* sil_u;
|
||||
u3_weak pil;
|
||||
|
||||
u3C.wag_w |= u3o_hashless;
|
||||
u3m_boot_lite();
|
||||
sil_u = u3s_cue_xeno_init_with(ur_fib27, ur_fib28);
|
||||
if ( u3_none == (pil = u3s_cue_xeno_with(sil_u, len_d, byt_y)) ) {
|
||||
printf("*** fail _setup 1\n");
|
||||
exit(1);
|
||||
}
|
||||
u3s_cue_xeno_done(sil_u);
|
||||
if ( c3n == u3v_boot_lite(pil) ) {
|
||||
printf("*** fail _setup 2\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* _test_lily(): test small noun parsing.
|
||||
*/
|
||||
static void
|
||||
_test_lily()
|
||||
{
|
||||
c3_l lit_l;
|
||||
c3_w big_w[] = {0, 0, 1};
|
||||
u3_noun big = u3i_words(3, big_w);
|
||||
u3_noun cod = u3dc("scot", c3__uv, big);
|
||||
|
||||
if ( c3y == u3v_lily(c3__uv, cod, &lit_l) ) {
|
||||
printf("*** fail _test_lily-1\n");
|
||||
exit(1);
|
||||
}
|
||||
cod = u3dc("scot", c3__ud, 0x7fffffff);
|
||||
if ( (c3n == u3v_lily(c3__ud, cod, &lit_l)) ||
|
||||
(0x7fffffff != lit_l) ) {
|
||||
printf("*** fail _test_lily-2a\n");
|
||||
exit(1);
|
||||
}
|
||||
cod = u3dc("scot", c3__ux, u3i_word(0x80000000));
|
||||
if ( c3y == u3v_lily(c3__ux, cod, &lit_l) ) {
|
||||
printf("*** fail _test_lily-2b\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* main(): run all test cases.
|
||||
*/
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
_setup();
|
||||
|
||||
_test_lily();
|
||||
|
||||
fprintf(stderr, "test boot: ok\n");
|
||||
return 0;
|
||||
}
|
@ -1,7 +1,4 @@
|
||||
#include "all.h"
|
||||
#include "ur/ur.h"
|
||||
#include "vere/ivory.h"
|
||||
#include "vere/vere.h"
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
@ -11,23 +8,8 @@
|
||||
static void
|
||||
_setup(void)
|
||||
{
|
||||
c3_d len_d = u3_Ivory_pill_len;
|
||||
c3_y* byt_y = u3_Ivory_pill;
|
||||
u3_cue_xeno* sil_u;
|
||||
u3_weak pil;
|
||||
|
||||
u3C.wag_w |= u3o_hashless;
|
||||
u3m_boot_lite();
|
||||
sil_u = u3s_cue_xeno_init_with(ur_fib27, ur_fib28);
|
||||
if ( u3_none == (pil = u3s_cue_xeno_with(sil_u, len_d, byt_y)) ) {
|
||||
printf("*** fail _setup 1\n");
|
||||
exit(1);
|
||||
}
|
||||
u3s_cue_xeno_done(sil_u);
|
||||
if ( c3n == u3v_boot_lite(pil) ) {
|
||||
printf("*** fail _setup 2\n");
|
||||
exit(1);
|
||||
}
|
||||
u3m_init();
|
||||
u3m_pave(c3y);
|
||||
}
|
||||
|
||||
/* _util_rand_string(): dynamically allocated len_w random string
|
||||
@ -1652,33 +1634,6 @@ _test_nvm_stack()
|
||||
#endif
|
||||
}
|
||||
|
||||
/* _test_lily(): test small noun parsing.
|
||||
*/
|
||||
static void
|
||||
_test_lily()
|
||||
{
|
||||
c3_l lit_l;
|
||||
c3_w big_w[] = {0, 0, 1};
|
||||
u3_noun big = u3i_words(3, big_w);
|
||||
u3_noun cod = u3dc("scot", c3__uv, big);
|
||||
|
||||
if ( c3y == u3v_lily(c3__uv, cod, &lit_l) ) {
|
||||
printf("*** fail _test_lily-1\n");
|
||||
exit(1);
|
||||
}
|
||||
cod = u3dc("scot", c3__ud, 0x7fffffff);
|
||||
if ( (c3n == u3v_lily(c3__ud, cod, &lit_l)) ||
|
||||
(0x7fffffff != lit_l) ) {
|
||||
printf("*** fail _test_lily-2a\n");
|
||||
exit(1);
|
||||
}
|
||||
cod = u3dc("scot", c3__ux, u3i_word(0x80000000));
|
||||
if ( c3y == u3v_lily(c3__ux, cod, &lit_l) ) {
|
||||
printf("*** fail _test_lily-2b\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* main(): run all test cases.
|
||||
*/
|
||||
int
|
||||
@ -1698,7 +1653,6 @@ main(int argc, char* argv[])
|
||||
_test_cells_complex();
|
||||
_test_u3r_at();
|
||||
_test_nvm_stack();
|
||||
_test_lily();
|
||||
|
||||
fprintf(stderr, "test_noun: ok\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user