6 Commits
Author SHA1 Message Date
hoangto105860 74360620be edit test_readWords_with_delimiters 2026-10-20 16:58:25 +02:00
hoangto105860 1cc06c0e2e change test_readWords_simple 2026-10-20 16:46:35 +02:00
hoangto105860 23c1ae2059 Merge branch 'tommy' 2026-10-17 20:14:48 +02:00
hoangto105860 683b0fd86e add .gitignore 2026-10-17 20:11:14 +02:00
hoangto105860 4cbd8d51c6 Revert "commit"
This reverts commit 8ae62a2f90.
2026-10-17 19:30:13 +02:00
hoangto105860 8ae62a2f90 commit 2026-10-17 19:20:57 +02:00
9 changed files with 312 additions and 12 deletions

No files matched your search

+276
View File
@@ -0,0 +1,276 @@
# Created by https://www.toptal.com/developers/gitignore/api/linux,windows,macos,visualstudiocode,clion,eclipse
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,windows,macos,visualstudiocode,clion,eclipse
### CLion ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### CLion Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
.apt_generated_test/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project
### Eclipse Patch ###
# Spring Boot Tooling
.sts4-cache/
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/linux,windows,macos,visualstudiocode,clion,eclipse
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+36 -12
View File
@@ -32,27 +32,51 @@ void print_test_result(int result) {
void test_readWords_simple(void) {
FILE *f = fopen("testwords_simple.txt", "r");
char words[10][MAX_WORD_LEN];
int count = readWords(f, words, 10);
char words[14][MAX_WORD_LEN];
int count = readWords(f, words, 14);
fclose(f);
TEST_ASSERT_EQUAL_INT(3, count);
TEST_ASSERT_EQUAL_STRING("APFEL", words[0]);
TEST_ASSERT_EQUAL_STRING("BANANE", words[1]);
TEST_ASSERT_EQUAL_STRING("KIWI", words[2]);
TEST_ASSERT_EQUAL_INT(15, count);
TEST_ASSERT_EQUAL_STRING("Yeti", words[0]);
TEST_ASSERT_EQUAL_STRING("Nessie", words[1]);
TEST_ASSERT_EQUAL_STRING("Werwolf", words[2]);
TEST_ASSERT_EQUAL_STRING("Vampir", words[3]);
TEST_ASSERT_EQUAL_STRING("Monster", words[4]);
TEST_ASSERT_EQUAL_STRING("Hydra", words[5]);
TEST_ASSERT_EQUAL_STRING("Frankenstein", words[6]);
TEST_ASSERT_EQUAL_STRING("Dracula", words[7]);
TEST_ASSERT_EQUAL_STRING("KingKong", words[8]);
TEST_ASSERT_EQUAL_STRING("Gremlin", words[9]);
TEST_ASSERT_EQUAL_STRING("Kobold", words[10]);
TEST_ASSERT_EQUAL_STRING("Hexe", words[11]);
TEST_ASSERT_EQUAL_STRING("Poltergeist", words[12]);
TEST_ASSERT_EQUAL_STRING("Gespenst", words[13]);
TEST_ASSERT_EQUAL_STRING("Oger", words[14]);
}
void test_readWords_with_delimiters(void) {
FILE *f = fopen("testwords_delims.txt", "r");
char words[10][MAX_WORD_LEN];
int count = readWords(f, words, 10);
char words[14][MAX_WORD_LEN];
int count = readWords(f, words, 14);
fclose(f);
TEST_ASSERT_EQUAL_INT(3, count);
TEST_ASSERT_EQUAL_STRING("HUND", words[0]);
TEST_ASSERT_EQUAL_STRING("KATZE", words[1]);
TEST_ASSERT_EQUAL_STRING("MAUS", words[2]);
TEST_ASSERT_EQUAL_INT(15, count);
TEST_ASSERT_EQUAL_STRING("Yeti", words[0]);
TEST_ASSERT_EQUAL_STRING("Nessie", words[1]);
TEST_ASSERT_EQUAL_STRING("Werwolf", words[2]);
TEST_ASSERT_EQUAL_STRING("Vampir", words[3]);
TEST_ASSERT_EQUAL_STRING("Monster", words[4]);
TEST_ASSERT_EQUAL_STRING("Hydra", words[5]);
TEST_ASSERT_EQUAL_STRING("Frankenstein", words[6]);
TEST_ASSERT_EQUAL_STRING("Dracula", words[7]);
TEST_ASSERT_EQUAL_STRING("KingKong", words[8]);
TEST_ASSERT_EQUAL_STRING("Gremlin", words[9]);
TEST_ASSERT_EQUAL_STRING("Kobold", words[10]);
TEST_ASSERT_EQUAL_STRING("Hexe", words[11]);
TEST_ASSERT_EQUAL_STRING("Poltergeist", words[12]);
TEST_ASSERT_EQUAL_STRING("Gespenst", words[13]);
TEST_ASSERT_EQUAL_STRING("Oger", words[14]);
}
void test_readWords_empty_file(void) {
Binary file not shown.
Binary file not shown.