--- /dev/null
+#!/bin/sh
+
+mysqldiff
+
+cleannsupdate <<!
+server $nameserver $port
+zone test.dyndns
+update add a.b.c.delegate.test.dyndns. 3600 NS ns1.test.dyndns
+update add c.delegate.test.dyndns. 3600 NS ns1.test.dyndns
+send
+answer
+!
+
+mysqldiff 1 "Check if delegates are added."
+
+cleannsupdate <<!
+server $nameserver $port
+zone test.dyndns
+update delete c.delegate.test.dyndns.
+send
+answer
+!
+
+mysqldiff 2 "Check if c.delegate.test.dyndns. was removed correctly."
+
+
+cleannsupdate <<!
+server $nameserver $port
+zone test.dyndns
+update delete a.b.c.delegate.test.dyndns.
+send
+answer
+!
+
+mysqldiff 3 "Check if records are all removed"
--- /dev/null
+This test performs a simple add and delete of an A-record using RFC2136.
--- /dev/null
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if delegates are added.
+--- Start: diff start step.1 ---
+> a.b.c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600
+> c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600
+--- End: diff start step.1 ---
+
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if c.delegate.test.dyndns. was removed correctly.
+--- Start: diff start step.2 ---
+> a.b.c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600
+--- End: diff start step.2 ---
+
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if records are all removed
+--- Start: diff start step.3 ---
+no differnce
+--- End: diff start step.3 ---
+
--- /dev/null
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if delegates are added.
+--- Start: diff start step.1 ---
+> a.b.c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600 'delegate c b a' 0
+> c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600 'delegate c' 0
+--- End: diff start step.1 ---
+
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if c.delegate.test.dyndns. was removed correctly.
+--- Start: diff start step.2 ---
+> a.b.c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600 'delegate c b a' 0
+--- End: diff start step.2 ---
+
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if records are all removed
+--- Start: diff start step.3 ---
+no differnce
+--- End: diff start step.3 ---
+
--- /dev/null
+TODO: UPDATE!
+
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if delegates are added.
+--- Start: diff start step.1 ---
+< test.dyndns MX 10 host-1.test.dyndns 3600 NULL 1
+< test.dyndns MX 20 host-2.test.dyndns 3600 NULL 1
+< test.dyndns NS 0 ns1.test.dyndns 3600 NULL 1
+< test.dyndns NS 0 ns2.test.dyndns 3600 NULL 1
+> a.b.c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600 NULL 0
+> c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600 NULL 0
+> test.dyndns MX 10 host-1.test.dyndns 3600 '' 1
+> test.dyndns MX 20 host-2.test.dyndns 3600 '' 1
+> test.dyndns NS 0 ns1.test.dyndns 3600 '' 1
+> test.dyndns NS 0 ns2.test.dyndns 3600 '' 1
+--- End: diff start step.1 ---
+
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if c.delegate.test.dyndns. was removed correctly.
+--- Start: diff start step.2 ---
+< test.dyndns MX 10 host-1.test.dyndns 3600 NULL 1
+< test.dyndns MX 20 host-2.test.dyndns 3600 NULL 1
+< test.dyndns NS 0 ns1.test.dyndns 3600 NULL 1
+< test.dyndns NS 0 ns2.test.dyndns 3600 NULL 1
+> a.b.c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600 NULL 0
+> test.dyndns MX 10 host-1.test.dyndns 3600 '' 1
+> test.dyndns MX 20 host-2.test.dyndns 3600 '' 1
+> test.dyndns NS 0 ns1.test.dyndns 3600 '' 1
+> test.dyndns NS 0 ns2.test.dyndns 3600 '' 1
+--- End: diff start step.2 ---
+
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if records are all removed
+--- Start: diff start step.3 ---
+< test.dyndns MX 10 host-1.test.dyndns 3600 NULL 1
+< test.dyndns MX 20 host-2.test.dyndns 3600 NULL 1
+< test.dyndns NS 0 ns1.test.dyndns 3600 NULL 1
+< test.dyndns NS 0 ns2.test.dyndns 3600 NULL 1
+> test.dyndns MX 10 host-1.test.dyndns 3600 '' 1
+> test.dyndns MX 20 host-2.test.dyndns 3600 '' 1
+> test.dyndns NS 0 ns1.test.dyndns 3600 '' 1
+> test.dyndns NS 0 ns2.test.dyndns 3600 '' 1
+--- End: diff start step.3 ---
+
--- /dev/null
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if delegates are added.
+--- Start: diff start step.1 ---
+> a.b.c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600 NULL 0
+> c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600 NULL 0
+--- End: diff start step.1 ---
+
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if c.delegate.test.dyndns. was removed correctly.
+--- Start: diff start step.2 ---
+> a.b.c.delegate.test.dyndns NS 0 ns1.test.dyndns 3600 NULL 0
+--- End: diff start step.2 ---
+
+Answer:
+;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id]
+;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
+;; ZONE SECTION:
+;test.dyndns. IN SOA
+
+Check if records are all removed
+--- Start: diff start step.3 ---
+no differnce
+--- End: diff start step.3 ---
+
--- /dev/null
+Skip this test if the backend does not support dyndns/rfc2136