from pathlib import Path
root=Path(__file__).resolve().parents[2]
checks={
'MASRating factory':'Public Function AddRating(Optional value As Double = 0.0R',
'MASRating default maximum':'Optional maximum As Integer = 5',
'MASRating event':'Public Event ValueChanged As EventHandler',
'MASTimeline factory':'Public Function AddTimeline(Optional title As String = Nothing',
'MASTimeline events':'Public Event ItemsChanged As EventHandler',
'MASTimeline first selection':'If _selectedIndex < 0 AndAlso _items.Count = 1 Then _selectedIndex = 0',
'Validation factory':'Public Function AddFormValidationSummary(Optional title As String = Nothing',
'Validation event':'Public Event FormValidationSummaryChanged As EventHandler',
'Notification factory':'Public Function AddNotificationPanel(Optional title As String = Nothing',
'Notification changed event':'Public Event NotificationsChanged As EventHandler',
'Notification default unread':'Optional isUnread As Boolean = True',
'Notification index return':'Return _items.Count - 1',
}
files='\n'.join(p.read_text(errors='ignore') for p in root.rglob('*.vb'))
failed=[]
for name,text in checks.items():
    if text not in files: failed.append(name)
doc=root/'docs/reference/controls/ratings-timelines-and-notifications.md'
if not doc.exists(): failed.append('documentation file')
if failed:
    print('FAILED:', ', '.join(failed)); raise SystemExit(1)
print(f'Assertions: {len(checks)} passed, 0 failed')
