# test the "in" keyword with maps

global a, b, c

probe begin {
	for (i=0;i<11;i++)
		a[i] = i*i 	
	
	if (0 in a) printf("0 is there\n")
	if (1 in a) printf("1 is there\n")
	if (50 in a) printf("ERROR: 50 is there\n")

	printf("complete list for a: ")
	for (i=0;i<11;i++)
		if (i in a) printf("%d ", i)
	printf("\n")

	a[0] = 0
	if (0 in a) printf("0 is still there\n")

	delete a[0]
	if (0 in a) printf("ERROR: 0 is there after delete\n")

	for (i=0;i<11;i++)
		b[i, 10*i] = i*i 	
	printf("complete list for b: ")
	for (i=0;i<11;i++)
		if ([i,10*i] in b) printf("[%d,%d] ", i, 10*i)
	printf("\n")
	b[0,0] = 0
	if ([0,0] in b) printf("[0,0] is still there\n")

	delete b[0,0]
	if ([0,0] in b) printf("ERROR: [0,0] is there after delete\n")
	
	c[""] = "empty string"
	c["hello"] = "HELLO"
	if ([""] in c) printf ("empty string there\n")
	if (["hello"] in c) printf ("hello there\n")
	c[""] = ""
	if ([""] in c) printf ("empty string still there\n")
	delete c[""]
	if ([""] in c) printf ("ERROR: empty string still there after delete\n")
	exit()
}

