3 * Copyright 2007 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "qa_jd_stack.h"
23 #include <cppunit/TestAssert.h>
24 #include <gcell/gc_jd_stack.h>
29 static const int NJDS = 8;
30 static gc_jd_stack_t stack;
31 static gc_job_desc_t jds[NJDS];
33 // no brainer, single threaded basic checkout
37 // N.B., stack allocated stuff doesn't obey ((aligned (N))) attributes
39 //gc_jd_stack_t stack;
40 //gc_job_desc_t jds[NJDS];
42 //printf("&stack = %p\n", &stack);
43 //printf("&jds[0] = %p\n", &jds[0]);
44 //printf("&jds[1] = %p\n", &jds[1]);
46 CPPUNIT_ASSERT(((uintptr_t) &stack & 0x7f) == 0);
47 CPPUNIT_ASSERT(((uintptr_t) &jds[0] & 0x7f) == 0);
48 CPPUNIT_ASSERT(((uintptr_t) &jds[1] & 0x7f) == 0);
50 gc_jd_stack_init(&stack);
52 CPPUNIT_ASSERT(gc_jd_stack_pop(&stack) == 0);
54 for (int i = 0; i < NJDS; i++)
55 gc_jd_stack_push(&stack, &jds[i]);
57 for (int i = 0; i < NJDS; i++)
58 CPPUNIT_ASSERT_EQUAL(&jds[NJDS - i - 1], gc_jd_stack_pop(&stack));
60 CPPUNIT_ASSERT(gc_jd_stack_pop(&stack) == 0);
63 // FIXME multithreaded (running on PPE)