func validateTotMemory(mem string) memory.MemSize {
	if mem == "" {
		fmt.Fprintf(os.Stderr, "-%s must be specified", totalFlag)
		os.Exit(1)
	}
	ms, err := memory.NewMemSizeFromString(mem)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error in -%s flag: %s", totalFlag, err)
		os.Exit(1)
	}
	if ms.LessThan(memory.MemSize(1024)) {
		fmt.Fprintf(os.Stderr, "Total memory (-%s flag) is less than 1K", totalFlag)
		os.Exit(1)
	}
	return ms
}
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("MemorySize", func() {

	Context("basic constructors", func() {

		var (
			testItWorks func(string, int64)
			testItFails func(string)
		)

		BeforeEach(func() {
			testItWorks = func(memStr string, memVal int64) {
				ms, err := memory.NewMemSizeFromString(memStr)
				Ω(err).ShouldNot(HaveOccurred())
				Ω(ms.Bytes()).Should(Equal(memVal))
			}

			testItFails = func(memStr string) {
				ms, err := memory.NewMemSizeFromString(memStr)
				Ω(ms).Should(BeZero())
				Ω(err).Should(HaveOccurred())
			}
		})

		Context("succeeds", func() {
			It("accepts memory sizes in bytes, kilobytes, megabytes, or gigabytes", func() {
				testItWorks("1024b", kILO)
				testItWorks("1024B", kILO)