repo_description: The AWS Provider enables Terraform to manage AWS resources.
repo_topics: aws terraform terraform-provider
code: // Copyright IBM Corp. 2014, 2026
  // SPDX-License-Identifier: MPL-2.0
  
  package dns
  
  import (
  	"testing"
  )
  
  func TestReverse(t *testing.T) {
  	t.Parallel()
  
  	testCases := []struct {
  		name     string
  		input    string
  		expected string
  	}{
  		{
  			name:     "empty",
  			input:    "",
  			expected: "",
  		},
  		{
  			name:     "amazonaws.com",
  			input:    "amazonaws.com",
  			expected: "com.amazonaws",
  		},
  		{
  			name:     "amazonaws.com.cn",
  			input:    "amazonaws.com.cn",
  			expected: "cn.com.amazonaws",
  		},
  		{
  			name:     "sc2s.sgov.gov",
  			input:    "sc2s.sgov.gov",
  			expected: "gov.sgov.sc2s",
  		},
  		{
  			name:     "c2s.ic.gov",
  			input:    "c2s.ic.gov",
  			expected: "gov.ic.c2s",
  		},
  	}
  
  	for _, testCase := range testCases {
  		t.Run(testCase.name, func(t *testing.T) {
  			t.Parallel()
  
  			if got, want := Reverse(testCase.input), testCase.expected; got != want {
  				t.Errorf("got: %s, expected: %s", got, want)
  			}
  		})
  	}
  }
  