-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add clif/testing/python/absl_cord_test.py
The new test passes with PyCLIF-pybind11 only with cl/620916112. GitHub testing: #95 PiperOrigin-RevId: 620966877
- Loading branch information
Showing
6 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef CLIF_TESTING_ABSL_CORD_H_ | ||
#define CLIF_TESTING_ABSL_CORD_H_ | ||
|
||
#include <string> | ||
|
||
#include "absl/strings/cord.h" | ||
|
||
namespace clif_testing_absl_cord { | ||
|
||
inline std::string PassAbslCord(const absl::Cord& c) { return std::string(c); } | ||
inline absl::Cord ReturnAbslCord(const std::string& s) { return absl::Cord(s); } | ||
|
||
} // namespace clif_testing_absl_cord | ||
|
||
#endif // CLIF_TESTING_ABSL_CORD_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from "clif/testing/absl_cord.h": | ||
namespace `clif_testing_absl_cord`: | ||
def `PassAbslCord` as PassAbslCordStr(c: `absl::Cord` as str) -> bytes | ||
def `PassAbslCord` as PassAbslCordBytes(c: `absl::Cord` as bytes) -> bytes | ||
def `ReturnAbslCord` as ReturnAbslCordStr(s: bytes) -> `absl::Cord` as str | ||
def `ReturnAbslCord` as ReturnAbslCordBytes(s: bytes) -> `absl::Cord` as bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from absl.testing import absltest | ||
|
||
from clif.testing.python import absl_cord | ||
|
||
|
||
class AbslCordTest(absltest.TestCase): | ||
|
||
def testPassAbslCord(self): | ||
self.assertEqual(absl_cord.PassAbslCordStr('P str'), b'P str') | ||
self.assertEqual(absl_cord.PassAbslCordBytes(b'P bytes'), b'P bytes') | ||
|
||
def testReturnAbslCord(self): | ||
self.assertEqual(absl_cord.ReturnAbslCordStr(b'R str'), 'R str') | ||
self.assertEqual(absl_cord.ReturnAbslCordBytes(b'R bytes'), b'R bytes') | ||
|
||
|
||
if __name__ == '__main__': | ||
absltest.main() |