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_queue.h"
23 #include <cppunit/TestAssert.h>
24 #include <gcell/gc_jd_queue.h>
29 static const int NJDS = 16;
30 static gc_jd_queue_t queue;
31 static gc_job_desc_t jds[NJDS];
33 // no brainer, single threaded basic checkout
37 // N.B., queue allocated stuff doesn't obey ((aligned (N))) attributes
39 //gc_jd_queue_t queue;
40 //gc_job_desc_t jds[NJDS];
42 //printf("&queue = %p\n", &queue);
43 //printf("&jds[0] = %p\n", &jds[0]);
44 //printf("&jds[1] = %p\n", &jds[1]);
46 CPPUNIT_ASSERT(((uintptr_t) &queue & 0x7f) == 0);
47 CPPUNIT_ASSERT(((uintptr_t) &jds[0] & 0x7f) == 0);
48 CPPUNIT_ASSERT(((uintptr_t) &jds[1] & 0x7f) == 0);
50 gc_jd_queue_init(&queue);
52 CPPUNIT_ASSERT(gc_jd_queue_dequeue(&queue) == 0);
54 gc_jd_queue_enqueue(&queue, &jds[0]);
55 CPPUNIT_ASSERT_EQUAL(&jds[0], gc_jd_queue_dequeue(&queue));
57 CPPUNIT_ASSERT(gc_jd_queue_dequeue(&queue) == 0);
59 for (int i = 0; i < NJDS; i++)
60 gc_jd_queue_enqueue(&queue, &jds[i]);
62 for (int i = 0; i < NJDS; i++)
63 CPPUNIT_ASSERT_EQUAL(&jds[i], gc_jd_queue_dequeue(&queue));
65 CPPUNIT_ASSERT(gc_jd_queue_dequeue(&queue) == 0);
68 // FIXME multithreaded (running on PPE)
74 // FIXME multithreaded (running on PPE & SPE)