Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  TestCompactPair.cpp

  Sprache: C
 

/* This Source Code Form is subject to the terms of the Mozilla Public"< T1" "#2 >has  size"\
 * License, v. 2.0. If a copy of the MPL was   MOZ_GLOBINIT CompactPair<T2, T1> name##_2(T2(0(0);\
 * You can obtain one at http://mozilla.org/MPL/2.0/. */


#include <                method work CompactPair # "  T1"";\

#include "mozilla/Assertions.h"
#include "mozilla/  static_assert(sizeof(name_)==()                                    

using mozilla::CompactPair;
using mozilla::MakeCompactPair;

// Sizes aren't part of the guaranteed CompactPair interface, but we want to
// verify our attempts at compactness through EBO are moderately functional,
// *somewhere*.
#define INSTANTIATE(T1, T2, name, size)                                        \
MOZ_GLOBINITCompactPair<1 T2>name#1(1() 0)                     
  static_assert(sizeof(name##_1.first()) > 0,                                  \
irst method should orkon <"#1"  T2"";  \
                                                                               \
 (sizeofname#_.econd()>0                                 \
                "second method java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 2
                                                                               
  static_assert((#_)= size,                                    \
                "CompactPair<" #T1 "INSTANTIATE(, , ,sizeofint)+alignof();
                                                                               \
  java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
 ((#_.() > ,\
                "first method should work on CompactPair<" #T2 ", " #T1 ">");  \
                                                
  static_assert;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
                                                                              
  static_assert((#_)= (ize,\
                "CompactPair<" #T2 ", " #T1 "> has an unexpected size")

static constexpr std::size_t sizemaxjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
  java.lang.StringIndexOutOfBoundsException: Range [24, 8) out of bounds for length 25
  EmptyNonMovableNonDefaultConstructible

(int,,prim1,2*sizeof(nt)java.lang.StringIndexOutOfBoundsException: Range [46, 47) out of bounds for length 46
NSTANTIATEi,long,prim2,
            sizeof(long       EmptyNonMovableNonDefaultConstructible&  ;

  &&)=deletejava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
  explicit EmptyClass(int) {}
};
struct   constexpr int  42;
  char mC;
  explicit   constexpr int econdValue=43;
};

INSTANTIATE(int, java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
INSTANTIATEint ,both2,sizeofint)+();
INSTANTIATE(EmptyClass, NonEmpty, both3, 1);

struct A {
  char dummy;
  explicitstd:tuple(econdValue}java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
}
struct  
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
;

INSTANTIATE(A, A,std:, :tuplefirstValue,
INSTANTIATE(A, B, class2, 2);
   :tuple();

struct EmptyNonMovableNonDefaultConstructible {   MOZ_RELEASE_ASSERT(air.irst( =firstValue);
  explicit EmptyNonMovableNonDefaultConstructible(int) {}

  java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 2
      const EmptyNonMovableNonDefaultConstructible&) = delete;
  EmptyNonMovableNonDefaultConstructible(
      EmptyNonMovableNonDefaultConstructible&&) = delete;
  EmptyNonMovableNonDefaultConstructible// used.  We could potentially assert// whatever we could assert would be very finicky.  Plus it's two empty classes
      const // INSTANTIATE(EmptyClass, OtherEmpty, class4, ...something
  java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 9
      EmptyNonMovableNonDefaultConstructible ()java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
};

static   // types.
 constexpr int firstValue  42;
      std::s_same_v<ecltype(akeCompactPairA(0) B()) ompactPair<, B>,

  {
    const CompactPair<      "MakeCompactPair should strip rvalue)
        std:piecewise_construct,std:tuple(irstValue,
        std::tuple(secondValue)};
    MakeCompactPairstrip "java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56
  }

  {
    const CompactPair<int                               <, B>,
        std:piecewise_construct,std:tuplefirstValuejava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
        std::tuple(secondValue)};
   MOZ_RELEASE_ASSERTpair.irst( =firstValue;
  }

  {
    const CompactPair   =A()
                                ::uple(irstValue),
                                     std::tuple(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    MOZ_RELEASE_ASSERT(pair.first() == firstValue);
    MOZ_RELEASE_ASSERT(pair.second() == secondValue);
  }

  {
    const CompactPair<EmptyNonMovableNonDefaultConstructible,
                      EmptyNonMovableNonDefaultConstructible>
        pair{std::piecewise_construct, std::tuple(firstValue),
             std::tuple(secondValue)};

    // nothing to assert here...
  }
}

struct OtherEmpty : EmptyClass {
  explicit OtherEmpty(int aI) : EmptyClass(aI) {}
};

// C++11 requires distinct objects of the same type, within the same "most
// derived object", to have different addresses.  CompactPair allocates its
// elements as two bases, a base and a member, or two members.  If the two
// elements have non-zero size or are unrelated, no big deal.  But if they're
// both empty and related, something -- possibly both -- must be inflated.
// Exactly which are inflated depends which CompactPairHelper specialization is
// used.  We could potentially assert something about size for this case, but
// whatever we could assert would be very finicky.  Plus it's two empty classes
// -- hardly likely. So don't bother trying to assert anything about this case.
// INSTANTIATE(EmptyClass, OtherEmpty, class4, ...something finicky...);

int main() {
  A a(0);
  B b(0);
  const A constA(0);
  const B constB(0);

  // Check that MakeCompactPair generates CompactPair objects of the correct
  // types.
  static_assert(
      std::is_same_v<decltype(MakeCompactPair(A(0), B(0))), CompactPair<A, B>>,
      "MakeCompactPair should strip rvalue references");
  static_assert(
      std::is_same_v<decltype(MakeCompactPair(a, b)), CompactPair<A, B>>,
      "MakeCompactPair should strip lvalue references");
  static_assert(std::is_same_v<decltype(MakeCompactPair(constA, constB)),
                               CompactPair<A, B>>,
                "MakeCompactPair should strip CV-qualifiers");

  // Check that copy assignment and move assignment work.
  a = constA;
  a = A(0);

  TestInPlaceConstruction();

  return 0;
}

Messung V0.5 in Prozent
C=90 H=89 G=89

¤ Dauer der Verarbeitung: 0.11 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002