package functions

import "testing"

func TestMapRoom(t *testing.T) {
	type args struct {
		room   string
		output bool
	}
	tests := []struct {
		name string
		args args
		want string
	}{
		{
			name: "Test 1 MapRoom",
			args: args{
				room:   "H.1.1",
				output: true,
			},
			want: "H11",
		},
		{
			name: "Test Treftsbau MapRoom",
			args: args{
				room:   "TR_L3.03-S,TR_L3.02-S,TR_L2.13-L,TR_L2.05-S,TR_L1.14-H,TR_L1.07-H,TR_L1.06-B,TR_L0.14-S,TR_Innenhof_FF,TR_C1.62-L,TR_B1.50-S,TR_B1.49-S,TR_B1.48-S,TR_B1.46-S,TR_B1.45-S,TR_B0.71-L,TR_B0.70-L,TR_B0.67-L,TR_A_Cafeteria,TR_A2.28-L,TR_A1.40-F,TR_A1.37-S,TR_A1.34-S,TR_A1.29-H,TR_A1.28-S,TR_A1.27-S,TR_A1.26-S,TR_A1.25-S,TR_A1.24-H,TR_A0.34-L,TR_A0.33-L,TR_A0.32.2-L,TR_A0.32.1-L,TR_A0.31.1-L,NI_FoyerK_F,NI_Foyer1_F,NI104-L,NI103-L,NI102-L,NI070-L,GU319-L,GU318-L,GU317b-L,GU317a-L,GU313-L,GU309-L,GU301-L,GU225-L,GU224-L,GU219-L,GU203-L,GU202-L,GU201-L,GU014-L,GU013-L,GU012-L,GU011-L,GU010-L,GU009-L,GU001-L,FÖ306-S,FÖ305-S,FÖ304-S",
				output: true,
			},
			want: "TR_L303,TR_L302,TR_L213,TR_L205,TR_L114,TR_L107,TR_L106,TR_L014,TR_Innenhof_FF,TR_C162,TR_B150,TR_B149,TR_B148,TR_B146,TR_B145,TR_B071,TR_B070,TR_B067,TR_A_Cafeteria,TR_A228,TR_A140,TR_A137,TR_A134,TR_A129,TR_A128,TR_A127,TR_A126,TR_A125,TR_A124,TR_A034,TR_A033,TR_A032-2,TR_A032-1,TR_A031-1,NI_FoyerK_F,NI_Foyer1_F,NI104,NI103,NI102,NI070,GU319,GU318,GU317b,GU317a,GU313,GU309,GU301,GU225,GU224,GU219,GU203,GU202,GU201,GU014,GU013,GU012,GU011,GU010,GU009,GU001,FÖ306,FÖ305,FÖ304",
		},
		{
			name: "Test Trefstbau MapRoom Input",
			args: args{
				room:   "TR_L321",
				output: false,
			},
			want: "TR_L3.21",
		},
		{
			name: "Test Trefstbau MapRoom Input",
			args: args{
				room:   "TR_A032-2",
				output: false,
			},
			want: "TR_A0.32.2",
		},
		{
			name: "Test Trefstbau MapRoom Input double point",
			args: args{
				//TR_A1.23.1 -> TR_A1.23-1
				room:   "TR_A1.23.1",
				output: true,
			},
			want: "TR_A123-1",
		},
		{
			name: "Test Trefstbau MapRoom Input double point with -S",
			args: args{
				//TR_A1.23.1 -> TR_A1.23-1
				room:   "TR_A1.23.1-S",
				output: true,
			},
			want: "TR_A123-1",
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := MapRoom(tt.args.room, tt.args.output); got != tt.want {
				t.Errorf("MapRoom() = %v, want %v", got, tt.want)
			}
		})
	}
}
