greenplumn url_curl_test 源码

  • 2022-08-18
  • 浏览 (402)

greenplumn url_curl_test 代码

文件路径:/src/backend/access/external/test/url_curl_test.c

#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include "cmockery.h"

#include "../url_curl.c"

static void
test__make_url(void **state)
{
	const char	   *url1 = "http://[:0]/foo/bar";
	const char	   *url2 = "http://[:0]:8080/foo/bar";
	char		   *result;

	/* test ipv6 with no port */
	expect_string(getDnsAddress, hostname, ":0");
	expect_value(getDnsAddress, port, 80);
	expect_value(getDnsAddress, elevel, ERROR);
	will_return(getDnsAddress, ":0");

	result = make_url(url1, true);
	assert_string_equal(url1, result);

	/* test ipv6 with explicit port */
	expect_string(getDnsAddress, hostname, ":0");
	expect_value(getDnsAddress, port, 8080);
	expect_value(getDnsAddress, elevel, ERROR);
	will_return(getDnsAddress, ":0");

	result = make_url(url2, true);
	assert_string_equal(url2, result);
}

int
main(int argc, char* argv[])
{
	cmockery_parse_arguments(argc, argv);

	const UnitTest tests[] = {
		unit_test(test__make_url)
	};

	MemoryContextInit();

	return run_tests(tests);
}

相关信息

greenplumn 源码目录

相关文章

greenplumn adminpack 源码

greenplumn verify_nbtree 源码

greenplumn auth_delay 源码

greenplumn auto_explain 源码

greenplumn blcost 源码

greenplumn blinsert 源码

greenplumn bloom 源码

greenplumn blscan 源码

greenplumn blutils 源码

greenplumn blvacuum 源码

0  赞