2001-02-09 23:11:52 +00:00
|
|
|
|
2013-05-08 02:35:06 +00:00
|
|
|
/*
|
2001-02-09 23:11:52 +00:00
|
|
|
* Very simple test program to check freq convertion --SF
|
2010-04-16 19:04:00 +00:00
|
|
|
* This is mainly to test kHz, MHz, GHz macros and int64_t support.
|
2001-02-09 23:11:52 +00:00
|
|
|
*/
|
|
|
|
|
2005-01-25 00:22:14 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2017-08-09 18:09:55 +00:00
|
|
|
# include "config.h"
|
2005-01-25 00:22:14 +00:00
|
|
|
#endif
|
|
|
|
|
2001-02-09 23:11:52 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <hamlib/rig.h>
|
2001-02-11 23:25:37 +00:00
|
|
|
#include "misc.h"
|
2001-02-09 23:11:52 +00:00
|
|
|
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
int main(int argc, char *argv[])
|
2001-02-09 23:11:52 +00:00
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
freq_t f = 0;
|
2001-02-09 23:11:52 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
2017-10-06 23:58:42 +00:00
|
|
|
if (argc != 2)
|
|
|
|
{
|
2017-08-09 18:09:55 +00:00
|
|
|
fprintf(stderr, "Usage: %s <freq>\n", argv[0]);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
f = atoi(argv[1]);
|
2001-02-09 23:11:52 +00:00
|
|
|
#endif
|
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
printf("%s\n", hamlib_version);
|
|
|
|
printf("caps size: %lu\n", (long unsigned) sizeof(struct rig_caps));
|
|
|
|
printf("state size: %lu\n", (long unsigned) sizeof(struct rig_state));
|
|
|
|
printf("RIG size: %lu\n", (long unsigned) sizeof(struct rig));
|
|
|
|
printf("freq_t size: %lu\n", (long unsigned) sizeof(freq_t));
|
|
|
|
printf("shortfreq_t size: %lu\n", (long unsigned) sizeof(shortfreq_t));
|
2001-02-09 23:11:52 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* freq on 31bits test */
|
|
|
|
f = GHz(2);
|
|
|
|
printf("GHz(2) = %"PRIll"\n", (int64_t)f);
|
2001-02-09 23:11:52 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* freq on 32bits test */
|
|
|
|
f = GHz(4);
|
|
|
|
printf("GHz(4) = %"PRIll"\n", (int64_t)f);
|
2001-02-09 23:11:52 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* freq on >32bits test */
|
|
|
|
f = GHz(5);
|
|
|
|
printf("GHz(5) = %"PRIll"\n", (int64_t)f);
|
2001-02-09 23:11:52 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* floating point to freq conversion test */
|
|
|
|
f = GHz(1.3);
|
|
|
|
printf("GHz(1.3) = %"PRIll"\n", (int64_t)f);
|
2001-02-09 23:11:52 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* floating point to freq conversion precision test */
|
|
|
|
f = GHz(1.234567890);
|
|
|
|
printf("GHz(1.234567890) = %"PRIll"\n", (int64_t)f);
|
2001-02-09 23:11:52 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
/* floating point to freq conversion precision test, with freq >32bits */
|
|
|
|
f = GHz(123.456789012);
|
|
|
|
printf("GHz(123.456789012) = %"PRIll"\n", (int64_t)f);
|
2001-02-09 23:11:52 +00:00
|
|
|
|
2017-08-09 18:09:55 +00:00
|
|
|
return 0;
|
2001-02-09 23:11:52 +00:00
|
|
|
}
|