Files
999/test/numerology_test.dart
T

101 lines
3.4 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:words999/models/syncretic_session_model.dart';
import 'package:words999/models/divination_instructions.dart';
import 'package:words999/screens/numerology_divination_screen.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
group('Numerology & Pythagorean Square Tests', () {
test('Instructions repository contains numerology entry', () {
final instruction = DivinationInstructionsRepository.get('numerology');
expect(instruction.id, equals('numerology'));
expect(instruction.title, contains('Пифагор'));
expect(instruction.icon, equals('🔢'));
expect(instruction.physicalDiceMethod, isNotEmpty);
expect(instruction.directInputMethod, isNotEmpty);
});
test('Canonical Alexandrian working numbers calculation (e.g. 15.07.1990)', () {
// Date: 15.07.1990
// Digits: 1, 5, 0, 7, 1, 9, 9, 0
// W1: 1+5+0+7+1+9+9+0 = 32
// W2: 3+2 = 5
// W3: 32 - 2 * 1 = 30
// W4: 3+0 = 3
const day = 15;
const month = 7;
const year = 1990;
final digits = [1, 5, 0, 7, 1, 9, 9, 0];
final w1 = digits.reduce((a, b) => a + b);
expect(w1, equals(32));
final w2 = (3 + 2);
expect(w2, equals(5));
final w3 = w1 - (2 * 1);
expect(w3, equals(30));
final w4 = 3 + 0;
expect(w4, equals(3));
// Digit pool:
// Date: 1, 5, 0, 7, 1, 9, 9, 0
// W1: 3, 2
// W2: 5
// W3: 3, 0
// W4: 3
// Counts for 1..9:
// 1: 1, 1 -> 2
// 2: 2 -> 1
// 3: 3, 3, 3 -> 3
// 4: 0
// 5: 5, 5 -> 2
// 6: 0
// 7: 7 -> 1
// 8: 0
// 9: 9, 9 -> 2
final pool = [1, 5, 0, 7, 1, 9, 9, 0, 3, 2, 5, 3, 0, 3];
expect(pool.where((d) => d == 1).length, equals(2));
expect(pool.where((d) => d == 2).length, equals(1));
expect(pool.where((d) => d == 3).length, equals(3));
expect(pool.where((d) => d == 4).length, equals(0));
expect(pool.where((d) => d == 5).length, equals(2));
expect(pool.where((d) => d == 7).length, equals(1));
expect(pool.where((d) => d == 9).length, equals(2));
});
test('SyncreticReading accepts numerology format', () {
final reading = SyncreticReading(
id: 'num_test_1',
systemId: 'numerology',
systemName: 'Нумерология и Квадрат Пифагора',
systemIcon: '🔢',
timestamp: DateTime.now(),
layoutTitle: 'Психоматрица 3×3 (ЧЖП: 5)',
inputMethod: 'manual',
items: [
const ReadingSignItem(
title: 'Число Жизненного Пути: 5',
subtitle: '5 — Искатель Свободы и Странник',
symbol: '5',
lore: 'Динамические перемены и расширение горизонтов.',
),
const ReadingSignItem(
title: 'Ячейка 1: Характер (11)',
subtitle: 'Норма',
symbol: '1',
),
],
);
final map = reading.toMap();
final revived = SyncreticReading.fromMap(map);
expect(revived.systemId, equals('numerology'));
expect(revived.items.length, equals(2));
expect(revived.items.first.title, contains('Число Жизненного Пути: 5'));
});
});
}