Moved tests to root folder, removed unused headers

This commit is contained in:
Bohdan 2020-09-13 18:20:10 +03:00
parent 9803d0549f
commit e8a15ea151
10 changed files with 29 additions and 50 deletions

View File

@ -54,3 +54,27 @@ cc_binary(
":guetzli_sapi", ":guetzli_sapi",
], ],
) )
cc_test(
name = "transaction_tests",
srcs = ["guetzli_transaction_test.cc"],
visibility=["//visibility:public"],
deps = [
"//:guetzli_sapi",
"@com_google_googletest//:gtest_main",
],
size = "large",
data = glob(["testdata/*"]),
)
cc_test(
name = "sapi_lib_tests",
srcs = ["guetzli_sapi_test.cc"],
visibility=["//visibility:public"],
deps = [
"//:guetzli_sapi",
"@com_google_googletest//:gtest_main",
],
size = "large",
data = glob(["testdata/*"]),
)

View File

@ -22,7 +22,7 @@
namespace guetzli::sandbox { namespace guetzli::sandbox {
class GuetzliSapiSandbox : public GuetzliSandbox { class GuetzliSapiSandbox : public GuetzliSandbox {
public: public:
std::unique_ptr<sandbox2::Policy> ModifyPolicy( std::unique_ptr<sandbox2::Policy> ModifyPolicy(
sandbox2::PolicyBuilder*) override { sandbox2::PolicyBuilder*) override {

View File

@ -12,12 +12,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <iostream> #include <iostream>
#include <cstdio> #include <cstdio>

View File

@ -41,7 +41,7 @@ constexpr int kDefaultQualityTarget = 95;
constexpr int kDefaultMemlimitMb = 6000; constexpr int kDefaultMemlimitMb = 6000;
constexpr absl::string_view kRelativePathToTestdata = constexpr absl::string_view kRelativePathToTestdata =
"/guetzli_sandboxed/tests/testdata/"; "/guetzli_sandboxed/testdata/";
std::string GetPathToInputFile(absl::string_view filename) { std::string GetPathToInputFile(absl::string_view filename) {
return absl::StrCat(getenv("TEST_SRCDIR"), kRelativePathToTestdata, filename); return absl::StrCat(getenv("TEST_SRCDIR"), kRelativePathToTestdata, filename);
@ -88,7 +88,7 @@ TEST_F(GuetzliSapiTest, ProcessRGB) {
kDefaultMemlimitMb kDefaultMemlimitMb
}; };
sapi::v::LenVal output(0); sapi::v::LenVal output(0);
auto processing_result = api_->ProcessRgb(processing_params.PtrBefore(), sapi::StatusOr<bool> processing_result = api_->ProcessRgb(processing_params.PtrBefore(),
output.PtrBoth()); output.PtrBoth());
ASSERT_TRUE(processing_result.value_or(false)) << "Error processing rgb data"; ASSERT_TRUE(processing_result.value_or(false)) << "Error processing rgb data";
std::string reference_data = std::string reference_data =
@ -115,7 +115,7 @@ TEST_F(GuetzliSapiTest, ProcessJpeg) {
kDefaultMemlimitMb kDefaultMemlimitMb
}; };
sapi::v::LenVal output(0); sapi::v::LenVal output(0);
auto processing_result = api_->ProcessJpeg(processing_params.PtrBefore(), sapi::StatusOr<bool> processing_result = api_->ProcessJpeg(processing_params.PtrBefore(),
output.PtrBoth()); output.PtrBoth());
ASSERT_TRUE(processing_result.value_or(false)) << "Error processing jpg data"; ASSERT_TRUE(processing_result.value_or(false)) << "Error processing jpg data";
std::string reference_data = std::string reference_data =

View File

@ -44,7 +44,7 @@ constexpr int kDefaultQualityTarget = 95;
constexpr int kDefaultMemlimitMb = 6000; constexpr int kDefaultMemlimitMb = 6000;
constexpr absl::string_view kRelativePathToTestdata = constexpr absl::string_view kRelativePathToTestdata =
"/guetzli_sandboxed/tests/testdata/"; "/guetzli_sandboxed/testdata/";
std::string GetPathToFile(absl::string_view filename) { std::string GetPathToFile(absl::string_view filename) {
return absl::StrCat(getenv("TEST_SRCDIR"), kRelativePathToTestdata, filename); return absl::StrCat(getenv("TEST_SRCDIR"), kRelativePathToTestdata, filename);

View File

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 173 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,39 +0,0 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
cc_test(
name = "transaction_tests",
srcs = ["guetzli_transaction_test.cc"],
visibility=["//visibility:public"],
deps = [
"//:guetzli_sapi",
"@com_google_googletest//:gtest_main",
],
size = "large",
data = glob(["testdata/*"]),
)
cc_test(
name = "sapi_lib_tests",
srcs = ["guetzli_sapi_test.cc"],
visibility=["//visibility:public"],
deps = [
"//:guetzli_sapi",
"@com_google_googletest//:gtest_main",
],
size = "large",
data = glob(["testdata/*"]),
)