diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-21 15:42:48 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-21 15:42:48 +0100 |
| commit | 55c649e790b73e3f8d493cd12c346e3bddcba25d (patch) | |
| tree | 4f50d87782a4ec58219e5a2ef468075b5e4d36f7 /test | |
| parent | 19356a292ba53b6d40270b1e74af5dad2304dbd5 (diff) | |
Remove some shared_ptr-itis.
Diffstat (limited to 'test')
| -rw-r--r-- | test/certificates_test.cc | 64 | ||||
| -rw-r--r-- | test/encryption_test.cc | 6 |
2 files changed, 35 insertions, 35 deletions
diff --git a/test/certificates_test.cc b/test/certificates_test.cc index 4f0a41f9..c9839d9c 100644 --- a/test/certificates_test.cc +++ b/test/certificates_test.cc @@ -31,9 +31,9 @@ BOOST_AUTO_TEST_CASE (certificates) { dcp::CertificateChain c; - c.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem")))); - c.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem")))); - c.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem")))); + c.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + c.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + c.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); dcp::CertificateChain::List leaf_to_root = c.leaf_to_root (); @@ -43,12 +43,12 @@ BOOST_AUTO_TEST_CASE (certificates) BOOST_CHECK_EQUAL (*i, c.leaf ()); BOOST_CHECK_EQUAL ( - c.leaf()->issuer(), + c.leaf().issuer(), "dnQualifier=bmtwThq3srgxIAeRMjX6BFhgLDw=,CN=.smpte-430-2.INTERMEDIATE.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" ); BOOST_CHECK_EQUAL ( - c.leaf()->subject(), + c.leaf().subject(), "dnQualifier=d95fGDzERNdxfYPgphvAR8A18L4=,CN=CS.smpte-430-2.LEAF.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" ); @@ -56,12 +56,12 @@ BOOST_AUTO_TEST_CASE (certificates) /* Intermediate */ BOOST_CHECK_EQUAL ( - (*i)->issuer(), + i->issuer(), "dnQualifier=ndND9A/cODo2rTdrbLVmfQnoaSc=,CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" ); BOOST_CHECK_EQUAL ( - (*i)->subject(), + i->subject(), "dnQualifier=bmtwThq3srgxIAeRMjX6BFhgLDw=,CN=.smpte-430-2.INTERMEDIATE.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" ); @@ -70,65 +70,65 @@ BOOST_AUTO_TEST_CASE (certificates) /* Root */ BOOST_CHECK_EQUAL (*i, c.root ()); BOOST_CHECK_EQUAL ( - c.root()->issuer(), + c.root().issuer(), "dnQualifier=ndND9A/cODo2rTdrbLVmfQnoaSc=,CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" ); - BOOST_CHECK_EQUAL (c.root()->serial(), "5"); + BOOST_CHECK_EQUAL (c.root().serial(), "5"); BOOST_CHECK_EQUAL ( - c.root()->subject(), + c.root().subject(), "dnQualifier=ndND9A/cODo2rTdrbLVmfQnoaSc=,CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" ); /* Check that reconstruction from a string works */ - dcp::Certificate test (c.root()->certificate (true)); - BOOST_CHECK_EQUAL (test.certificate(), c.root()->certificate()); + dcp::Certificate test (c.root().certificate (true)); + BOOST_CHECK_EQUAL (test.certificate(), c.root().certificate()); } /** Check that dcp::CertificateChain::valid() and ::attempt_reorder() basically work */ BOOST_AUTO_TEST_CASE (certificates_validation) { dcp::CertificateChain good1; - good1.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem")))); - good1.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem")))); - good1.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem")))); + good1.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + good1.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + good1.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); BOOST_CHECK (good1.valid ()); dcp::CertificateChain good2; - good2.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem")))); + good2.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); BOOST_CHECK (good2.valid ()); dcp::CertificateChain bad1; - bad1.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem")))); - bad1.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem")))); + bad1.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + bad1.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); BOOST_CHECK (!bad1.valid ()); BOOST_CHECK (!bad1.attempt_reorder ()); dcp::CertificateChain bad2; - bad2.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem")))); - bad2.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem")))); - bad2.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem")))); + bad2.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + bad2.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + bad2.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); BOOST_CHECK (!bad2.valid ()); BOOST_CHECK (bad2.attempt_reorder ()); dcp::CertificateChain bad3; - bad3.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem")))); - bad3.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem")))); - bad3.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem")))); + bad3.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + bad3.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + bad3.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); BOOST_CHECK (!bad3.valid ()); BOOST_CHECK (bad3.attempt_reorder ()); dcp::CertificateChain bad4; - bad4.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem")))); - bad4.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem")))); - bad4.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem")))); + bad4.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + bad4.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + bad4.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); BOOST_CHECK (!bad4.valid ()); BOOST_CHECK (bad4.attempt_reorder ()); dcp::CertificateChain bad5; - bad5.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem")))); - bad5.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem")))); + bad5.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + bad5.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); BOOST_CHECK (!bad5.valid ()); BOOST_CHECK (!bad5.attempt_reorder ()); } @@ -138,9 +138,9 @@ BOOST_AUTO_TEST_CASE (signer_validation) { /* Check a valid signer */ dcp::CertificateChain chain; - chain.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem")))); - chain.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem")))); - chain.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem")))); + chain.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + chain.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + chain.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); dcp::Signer signer (chain, dcp::file_to_string ("test/ref/crypt/leaf.key")); BOOST_CHECK (signer.valid ()); diff --git a/test/encryption_test.cc b/test/encryption_test.cc index e5acdbce..071de9db 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -67,9 +67,9 @@ BOOST_AUTO_TEST_CASE (encryption_test) /* Use test/ref/crypt so this test is repeatable */ dcp::CertificateChain chain; - chain.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem")))); - chain.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem")))); - chain.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem")))); + chain.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + chain.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + chain.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); shared_ptr<dcp::Signer> signer ( new dcp::Signer ( |
