func TestB2BFile(t *testing.T) {
	t.Parallel()
	SetLoggingLevel(logging.Level(*loggingLevel))

	// Load clean image
	var cleanImg StegImage
	err := cleanImg.LoadImageFromFile(cleanImageFile)
	if err != nil {
		t.Error(err)
	}

	// Embed secret
	err = cleanImg.DoStegEmbed(secretStringIn)
	if err != nil {
		t.Error(err)
	}

	// Create tmp file
	tmpTampered, err := ioutil.TempFile("", "")
	if err != nil {
		t.Error(err)
	}
	defer os.Remove(tmpTampered.Name())

	// Write manipulated image to file
	err = cleanImg.WriteNewImageToFile(tmpTampered.Name())
	if err != nil {
		t.Error(err)
	}

	var tamperedImg StegImage
	// Read it back in
	err = tamperedImg.LoadImageFromFile(tmpTampered.Name())
	if err != nil {
		t.Error(err)
	}

	var secretOut string
	secretOut, err = tamperedImg.DoStegExtract()
	if err != nil {
		t.Error(err)
	}

	if secretOut != secretStringIn {
		t.Error("Secrets Do Not Match!")
	} else if err != nil {
		t.Error(err)
	}
}
// TestB2BFile does a back to back file based test
TestB2BFile does a back to back file based test
// TestB2BFile does a back to back file based test
func TestB2BFile(t *testing.T) {
	t.Parallel()
	SetLoggingLevel(logging.Level(*loggingLevel))
	var cleanImg StegImage
	err := cleanImg.LoadImageFromFile(cleanImageFile)
	if err != nil {
		t.Error(err)
	}
	err = cleanImg.DoStegEmbed(secretStringIn)
	if err != nil {
		t.Error(err)
	}
	tmpTampered, err := ioutil.TempFile("", "")
	if err != nil {
		t.Error(err)
	}
	defer os.Remove(tmpTampered.Name())
	err = cleanImg.WriteNewImageToFile(tmpTampered.Name())
	if err != nil {
		t.Error(err)
	}
	var tamperedImg StegImage
	err = tamperedImg.LoadImageFromFile(tmpTampered.Name())
	if err != nil {
		t.Error(err)
	}
	var secretOut string
	secretOut, err = tamperedImg.DoStegExtract()
	if err != nil {
		t.Error(err)
	}
	if secretOut != secretStringIn {
		t.Error("Secrets Do Not Match!")
	} else if err != nil {
		t.Error(err)
	}
}
func TestB2BFile ( t * testing . T ) { t . Parallel ( ) SetLoggingLevel ( logging . Level ( * loggingLevel ) ) var cleanImg StegImage err := cleanImg . LoadImageFromFile ( cleanImageFile ) if err != nil { t . Error ( err ) } err = cleanImg . DoStegEmbed ( secretStringIn ) if err != nil { t . Error ( err ) } tmpTampered , err := ioutil . TempFile ( " " , " " ) if err != nil { t . Error ( err ) } defer os . Remove ( tmpTampered . Name ( ) ) err = cleanImg . WriteNewImageToFile ( tmpTampered . Name ( ) ) if err != nil { t . Error ( err ) } var tamperedImg StegImage err = tamperedImg . LoadImageFromFile ( tmpTampered . Name ( ) ) if err != nil { t . Error ( err ) } var secretOut string secretOut , err = tamperedImg . DoStegExtract ( ) if err != nil { t . Error ( err ) } if secretOut != secretStringIn { t . Error ( " " ) } else if err != nil { t . Error ( err ) } }
TestB2BFile does a back to back file based test
TestB2BFile does a back to back file based test
// Load clean image // Embed secret // Create tmp file // Write manipulated image to file // Read it back in