<commit_before>package common

import (
	"github.com/mitchellh/goamz/ec2"
	"reflect"
	"testing"
)

func TestBlockDevice(t *testing.T) {
	ec2Mapping := []ec2.BlockDeviceMapping{
		ec2.BlockDeviceMapping{
			DeviceName:          "/dev/sdb",
			VirtualName:         "ephemeral0",
			SnapshotId:          "snap-1234",
			VolumeType:          "standard",
			VolumeSize:          8,
			DeleteOnTermination: true,
			IOPS:                1000,
		},
	}

	blockDevice := BlockDevice{
		DeviceName:          "/dev/sdb",
		VirtualName:         "ephemeral0",
		SnapshotId:          "snap-1234",
		VolumeType:          "standard",
		VolumeSize:          8,
		DeleteOnTermination: true,
		IOPS:                1000,
	}

	blockDevices := BlockDevices{
		AMIMappings:    []BlockDevice{blockDevice},
		LaunchMappings: []BlockDevice{blockDevice},
	}

	if !reflect.DeepEqual(ec2Mapping, blockDevices.BuildAMIDevices()) {
		t.Fatalf("bad: %#v", ec2Mapping)
	}

	if !reflect.DeepEqual(ec2Mapping, blockDevices.BuildLaunchDevices()) {
		t.Fatalf("bad: %#v", ec2Mapping)
	}
}<commit_msg>builder/amazon: tests<commit_after>package common

import (
	"github.com/mitchellh/goamz/ec2"
	"reflect"
	"testing"
)

func TestBlockDevice(t *testing.T) {
	cases := []struct {
		Config *BlockDevice
		Result *ec2.BlockDeviceMapping
	}{
		{
			Config: &BlockDevice{
				DeviceName:          "/dev/sdb",
				VirtualName:         "ephemeral0",
				SnapshotId:          "snap-1234",
				VolumeType:          "standard",
				VolumeSize:          8,
				DeleteOnTermination: true,
				IOPS:                1000,
			},

			Result: &ec2.BlockDeviceMapping{
				DeviceName:          "/dev/sdb",
				VirtualName:         "ephemeral0",
				SnapshotId:          "snap-1234",
				VolumeType:          "standard",
				VolumeSize:          8,
				DeleteOnTermination: true,
				IOPS:                1000,
			},
		},
	}

	for _, tc := range cases {
		blockDevices := BlockDevices{
			AMIMappings:    []BlockDevice{*tc.Config},
			LaunchMappings: []BlockDevice{*tc.Config},
		}

		expected := []ec2.BlockDeviceMapping{*tc.Result}

		if !reflect.DeepEqual(expected, blockDevices.BuildAMIDevices()) {
			t.Fatalf("bad: %#v", expected)
		}

		if !reflect.DeepEqual(expected, blockDevices.BuildLaunchDevices()) {
			t.Fatalf("bad: %#v", expected)
		}
	}
}
{'fraction_non_alphanumeric': 0.13489991296779807, 'fraction_numerical': 0.022628372497824196, 'mean_word_length': 2.609105180533752, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '812445', 'n_tokens_mistral': 914, 'n_tokens_neox': 780, 'n_words': 132}