<commit_before>// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:pub_semver/pub_semver.dart';
import 'package:test/test.dart';

import 'utils.dart';

void main() {
  test('any', () {
    expect(VersionConstraint.any.isAny, isTrue);
    expect(
        VersionConstraint.any,
        allows(Version.parse('0.0.0-blah'), Version.parse('1.2.3'),
            Version.parse('12345.678.90')));
  });

  test('empty', () {
    expect(VersionConstraint.empty.isEmpty, isTrue);
    expect(VersionConstraint.empty.isAny, isFalse);
    expect(
        VersionConstraint.empty,
        doesNotAllow(Version.parse('0.0.0-blah'), Version.parse('1.2.3'),
            Version.parse('12345.678.90')));
  });

  group('parse()', () {
    test('parses an exact version', () {
      var constraint = VersionConstraint.parse('1.2.3-alpha');

      expect(constraint is Version, isTrue);
      expect(constraint, equals(Version(1, 2, 3, pre: 'alpha')));
    });

    test('parses "any"', () {
      var constraint = VersionConstraint.parse('any');

      expect(constraint is VersionConstraint, isTrue);
      expect(
          constraint,
          allows(Version.parse('0.0.0'), Version.parse('1.2.3'),
              Version.parse('12345.678.90')));
    });

    test('parses a ">" minimum version', () {
      var constraint = VersionConstraint.parse('>1.2.3');

      expect(constraint,
          allows(Version.parse('1.2.3+foo'), Version.parse('1.2.4')));
      expect(
          constraint,
          doesNotAllow(Version.parse('1.2.1'), Version.parse('1.2.3-build'),
              Version.parse('1.2.3')));
    });

    test('parses a ">=" minimum version', () {
      var constraint = VersionConstraint.parse('>=1.2.3');

      expect(<commit_msg>Fix pre-existing HintCode.UNNECESSARY_TYPE_CHECK_TRUE (#60)<commit_after>// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:pub_semver/pub_semver.dart';
import 'package:test/test.dart';

import 'utils.dart';

void main() {
  test('any', () {
    expect(VersionConstraint.any.isAny, isTrue);
    expect(
        VersionConstraint.any,
        allows(Version.parse('0.0.0-blah'), Version.parse('1.2.3'),
            Version.parse('12345.678.90')));
  });

  test('empty', () {
    expect(VersionConstraint.empty.isEmpty, isTrue);
    expect(VersionConstraint.empty.isAny, isFalse);
    expect(
        VersionConstraint.empty,
        doesNotAllow(Version.parse('0.0.0-blah'), Version.parse('1.2.3'),
            Version.parse('12345.678.90')));
  });

  group('parse()', () {
    test('parses an exact version', () {
      var constraint = VersionConstraint.parse('1.2.3-alpha');

      expect(constraint is Version, isTrue);
      expect(constraint, equals(Version(1, 2, 3, pre: 'alpha')));
    });

    test('parses "any"', () {
      var constraint = VersionConstraint.parse('any');

      expect(
          constraint,
          allows(Version.parse('0.0.0'), Version.parse('1.2.3'),
              Version.parse('12345.678.90')));
    });

    test('parses a ">" minimum version', () {
      var constraint = VersionConstraint.parse('>1.2.3');

      expect(constraint,
          allows(Version.parse('1.2.3+foo'), Version.parse('1.2.4')));
      expect(
          constraint,
          doesNotAllow(Version.parse('1.2.1'), Version.parse('1.2.3-build'),
              Version.parse('1.2.3')));
    });

    test('parses a ">=" minimum version', () {
      var constraint = VersionConstraint.parse('>=1.2.3');

      expect(
{'fraction_non_alphanumeric': 0.17437908496732027, 'fraction_numerical': 0.04183006535947712, 'mean_word_length': 2.8724696356275303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3378067', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1179, 'n_words': 234}