basic getrrsetbyname() tests

This commit is contained in:
Brian Wellington
2000-11-02 02:05:01 +00:00
parent 3a372f7aaf
commit 046862bebe
+31 -1
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwtest.c,v 1.17 2000/10/28 00:44:46 bwelling Exp $ */
/* $Id: lwtest.c,v 1.18 2000/11/02 02:05:01 bwelling Exp $ */
#include <config.h>
@@ -595,6 +595,32 @@ test_getnameinfo(const char *address, int af, const char *name) {
}
}
static void
test_getrrsetbyname(const char *name, int rdclass, int rdtype,
unsigned int nrdatas, unsigned int nsigs)
{
int ret;
struct rrsetinfo *rrinfo = NULL;
ret = getrrsetbyname(name, rdclass, rdtype, 0, &rrinfo);
if (ret != 0) {
printf("I:getrrsetbyname(%s, %d) returned %d, expected %d\n",
name, rdtype, ret, 0);
fails++;
return;
}
if (rrinfo->rri_nrdatas != nrdatas) {
printf("I:getrrsetbyname(%s, %d): got %d rr, expected %d\n",
name, rdtype, rrinfo->rri_nrdatas, nrdatas);
fails++;
}
if (rrinfo->rri_nsigs != nsigs) {
printf("I:getrrsetbyname(%s, %d): got %d sig, expected %d\n",
name, rdtype, rrinfo->rri_nsigs, nsigs);
fails++;
}
return;
}
int
main(void) {
lwres_result_t ret;
@@ -717,6 +743,10 @@ main(void) {
test_getnameinfo("1122:3344:5566:7788:99aa:bbcc:ddee:ff00",
AF_INET6, "dname.example1");
test_getrrsetbyname("a", 1, 1, 1, 0);
test_getrrsetbyname("a.example1.", 1, 1, 1, 0);
test_getrrsetbyname("e.example1.", 1, 1, 1, 1);
if (fails == 0)
printf("I:ok\n");
return (fails);