aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gsm0502/gsm0502_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gsm0502/gsm0502_test.c')
-rw-r--r--tests/gsm0502/gsm0502_test.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/gsm0502/gsm0502_test.c b/tests/gsm0502/gsm0502_test.c
index a950c6c1..7768abb0 100644
--- a/tests/gsm0502/gsm0502_test.c
+++ b/tests/gsm0502/gsm0502_test.c
@@ -15,10 +15,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
*/
#include <string.h>
@@ -90,7 +86,7 @@ uint32_t facch_h1_fn_samples[] = { 500728, 500771, 500797, 500841, 500875, 50091
502782, 502825, 502869, 502903, 502955, 502999
};
-static void test_gsm0502_fn_remap()
+static void test_gsm0502_fn_remap(void)
{
unsigned int i;
uint32_t fn_begin;
@@ -152,8 +148,28 @@ static void test_gsm0502_fn_remap()
printf("\n");
}
+static void test_gsm0502_fncmp(void)
+{
+ OSMO_ASSERT(gsm0502_fncmp(1337, 1337) == 0);
+ OSMO_ASSERT(gsm0502_fncmp(42, 1337) == -1);
+ OSMO_ASSERT(gsm0502_fncmp(1337, 42) == 1);
+ OSMO_ASSERT(gsm0502_fncmp(42, 0) == 1);
+
+ /* 2715642 is very close to the Fn period (GSM_TDMA_HYPERFRAME) */
+ OSMO_ASSERT(gsm0502_fncmp(2715642, 42) == -1);
+ OSMO_ASSERT(gsm0502_fncmp(42, 2715642) == 1);
+ OSMO_ASSERT(gsm0502_fncmp(0, 2715642) == 1);
+
+ /* 1357824 is half of the Fn period (GSM_TDMA_HYPERFRAME) */
+ OSMO_ASSERT(gsm0502_fncmp(1357820, 1357824) == -1);
+ OSMO_ASSERT(gsm0502_fncmp(1357820, 1357825) == -1);
+ OSMO_ASSERT(gsm0502_fncmp(1357824, 1357820) == 1);
+ OSMO_ASSERT(gsm0502_fncmp(1357825, 1357820) == 1);
+}
+
int main(int argc, char **argv)
{
test_gsm0502_fn_remap();
+ test_gsm0502_fncmp();
return EXIT_SUCCESS;
}