import 'dart:convert';

import 'package:test/test.dart';
import 'package:wolf_3d_dart/src/data/md5_hash.dart';

void main() {
  group('md5HexLower', () {
    test('matches canonical RFC vectors', () {
      expect(md5HexLower(const <int>[]), 'd41d8cd98f00b204e9800998ecf8427e');
      expect(
        md5HexLower(utf8.encode('abc')),
        '900150983cd24fb0d6963f7d28e17f72',
      );
      expect(
        md5HexLower(utf8.encode('The quick brown fox jumps over the lazy dog')),
        '9e107d9d372bb6826bd81d3542a419d6',
      );
      expect(
        md5HexLower(
          utf8.encode(
            '12345678901234567890123456789012345678901234567890123456789012345678901234567890',
          ),
        ),
        '57edf4a22be3c955ac49da2e2107b67a',
      );
    });

    test('returns lowercase 32-character hex output', () {
      final digest = md5HexLower(utf8.encode('Wolf3D'));
      expect(digest, hasLength(32));
      expect(digest, matches(RegExp(r'^[0-9a-f]{32}$')));
    });
  });
}
