// assertValid checks that every single isolator is valid and that
// the whole set is well built
498482
func (isolators Isolators) assertValid() error {
	typesMap := make(map[ACIdentifier]bool)
	for _, i := range isolators {
		v := i.Value()
		if v == nil {
			return ErrInvalidIsolator
		}
		if err := v.AssertValid(); err != nil {
			return err
		}
		if _, ok := typesMap[i.Name]; ok {
			if !v.multipleAllowed() {
				return fmt.Errorf(`isolators set contains too many instances of type %s"`, i.Name)
			}
		}
		for _, c := range v.Conflicts() {
			if _, found := typesMap[c]; found {
				return ErrIncompatibleIsolator
			}
		}
		typesMap[i.Name] = true
	}
	return nil
}
119744
func checkValid(data []byte, scan *scanner) error {
	scan.length_data = len(data)
	scan.reset()
	scan.endTop = true
	stream := streamByte{data: &data, pos: 0}
	op := scan.parseValue(&stream)

	if op == scanError {
		return scan.err
	}

	return nil
}
1062233
func AssertEqual(expected interface{}, result interface{}) {
	AssertType(expected, result)
	if expected == nil && result == nil {
		return
	}
	switch result.(type) {
	case string, int, error, bool:
		if expected != result {
			panic(fmt.Sprintf("Error: [] Mismatched Values\nExpected value: %v\nResult: %v", expected, result))
		}
	default:
		panic("Error: AssertEqual doesn't handles this type yet.")
	}

}
640284
func Assert(condition bool, format string, args ...interface{}) {
	if !condition {
		Panicf(format, args...)
	}
}
998074
func (s *DescribeCrossAccountAccessRoleOutput) SetValid(v bool) *DescribeCrossAccountAccessRoleOutput {
	s.Valid = &v
	return s
}
514211
func (s *messageStoreImpl) CheckValid(message interface{}) bool {
	s.lock.RLock()
	defer s.lock.RUnlock()

	for _, m := range s.messages {
		if s.pol(message, m.data) == common.MessageInvalidated {
			return false
		}
	}
	return true
}
404058
func (s *Statement) Assert(typ Code) *Statement {
	g := &Group{
		close:     ")",
		items:     []Code{typ},
		multi:     false,
		name:      "assert",
		open:      ".(",
		separator: "",
	}
	*s = append(*s, g)
	return s
}
1075550
func (u *Unit) PasswordValid(password string) bool {
	agentHash := utils.AgentPasswordHash(password)
	if agentHash == u.doc.PasswordHash {
		return true
	}
	return false
}
1191822
func ValidChallenge(name string) bool {
	switch name {
	case ChallengeTypeHTTP01,
		ChallengeTypeDNS01,
		ChallengeTypeTLSALPN01:
		return true
	default:
		return false
	}
}
741368
func (v *UUIDIsPresent) IsValid(errors *validate.Errors) {
	s := v.Field.String()
	if strings.TrimSpace(s) != "" && v.Field != uuid.Nil {
		return
	}

	if len(v.Message) > 0 {
		errors.Add(GenerateKey(v.Name), v.Message)
		return
	}

	errors.Add(GenerateKey(v.Name), fmt.Sprintf("%s can not be blank.", v.Name))
}
1285641
func (h HLL) IsValid() error {
	if len(h) < 8 {
		return errors.New("size too small")
	}

	if (len(h)-8)%3 != 0 {
		return errors.New("hll byte size sould be 8 + a multiple of 3")
	}
	m := Dense(h[8:]).m()
	if m&(m-1) != 0 {
		return errors.New("hll byte size sould be 8 + 3 times a power of two")
	}
	var p byte
	for z := m; z != 0; z >>= 1 {
		p++
	}
	p--
	if p < 4 || p > 25 {
		return errors.New("p must be between 4 and 25, inclusive")
	}
	if h[0]&(1<<6) == 0 {
		sz := sparse(h).size()
		if len(h) < 8+8*int(sz) {
			return errors.New("sparse HLL is corrupted")
		}
	}
	return nil
}
591632
func (v *TimeIsPresent) IsValid(errors *validate.Errors) {
	t := time.Time{}
	if v.Field.UnixNano() != t.UnixNano() {
		return
	}

	if len(v.Message) > 0 {
		errors.Add(GenerateKey(v.Name), v.Message)
		return
	}

	errors.Add(GenerateKey(v.Name), fmt.Sprintf("%s can not be blank.", v.Name))
}
178100
func (sp *SAMLServiceProvider) VerifyAssertionConditions(assertion *types.Assertion) (*WarningInfo, error) {
	warningInfo := &WarningInfo{}
	now := sp.Clock.Now()

	conditions := assertion.Conditions
	if conditions == nil {
		return nil, ErrMissingElement{Tag: ConditionsTag}
	}

	if conditions.NotBefore == "" {
		return nil, ErrMissingElement{Tag: ConditionsTag, Attribute: NotBeforeAttr}
	}

	notBefore, err := time.Parse(time.RFC3339, conditions.NotBefore)
	if err != nil {
		return nil, ErrParsing{Tag: NotBeforeAttr, Value: conditions.NotBefore, Type: "time.RFC3339"}
	}

	if now.Before(notBefore) {
		warningInfo.InvalidTime = true
	}

	if conditions.NotOnOrAfter == "" {
		return nil, ErrMissingElement{Tag: ConditionsTag, Attribute: NotOnOrAfterAttr}
	}

	notOnOrAfter, err := time.Parse(time.RFC3339, conditions.NotOnOrAfter)
	if err != nil {
		return nil, ErrParsing{Tag: NotOnOrAfterAttr, Value: conditions.NotOnOrAfter, Type: "time.RFC3339"}
	}

	if now.After(notOnOrAfter) {
		warningInfo.InvalidTime = true
	}

	for _, audienceRestriction := range conditions.AudienceRestrictions {
		matched := false

		for _, audience := range audienceRestriction.Audiences {
			if audience.Value == sp.AudienceURI {
				matched = true
				break
			}
		}

		if !matched {
			warningInfo.NotInAudience = true
			break
		}
	}

	if conditions.OneTimeUse != nil {
		warningInfo.OneTimeUse = true
	}

	proxyRestriction := conditions.ProxyRestriction
	if proxyRestriction != nil {
		proxyRestrictionInfo := &ProxyRestriction{
			Count:    proxyRestriction.Count,
			Audience: []string{},
		}

		for _, audience := range proxyRestriction.Audience {
			proxyRestrictionInfo.Audience = append(proxyRestrictionInfo.Audience, audience.Value)
		}

		warningInfo.ProxyRestriction = proxyRestrictionInfo
	}

	return warningInfo, nil
}
1010431
func (n name) IsValid() bool {
	for _, supn := range supportedConditions {
		if n == supn {
			return true
		}
	}

	return false
}
1282399
func (v *IntIsPresent) IsValid(errors *validate.Errors) {
	if v.Field != 0 {
		return
	}

	if len(v.Message) > 0 {
		errors.Add(GenerateKey(v.Name), v.Message)
		return
	}

	errors.Add(GenerateKey(v.Name), fmt.Sprintf("%s can not be blank.", v.Name))
}
662152
func (self *domAttr) verifyConstraint(b bool) {
	s := self.getData()
	if b {
		if s == "" {
			panic(fmt.Sprintf("expected to have constraint on %s but did not!", self.id))
		}
		if s != CONSTRAINT_MARKER {
			panic(fmt.Sprintf("expected to find constraint marker but found %s", s))
		}
	} else {
		if s != "" {
			panic(fmt.Sprintf("did not expect to have constraint on %s but found one: %s", self.id, s))
		}
	}
}
645674
func AssertNoError(err error) {
	if err == nil {
		return
	}
	if enableAssert {
		panic(err)
	}
	writeWithSync(2, "[ASSERT] "+err.Error())
}