Skip to content

Instantly share code, notes, and snippets.

@sftom
Last active September 23, 2022 05:06
Show Gist options
  • Save sftom/aee969cf169b9c01b9f26d116ebe03fb to your computer and use it in GitHub Desktop.
Save sftom/aee969cf169b9c01b9f26d116ebe03fb to your computer and use it in GitHub Desktop.
c\.vscode\
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py,c,md}]
charset = utf-8
# 2 space indentation
[*.{c,md}]
indent_style = space
indent_size = 2
# 4 space indentation
[*.py]
indent_style = space
indent_size = 4
# Tab indentation (no size specified)
[Makefile]
indent_style = tab
# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2
# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "gcc.exe - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.exe",
"args": [],
"stopAtEntry": false,
"cwd": "C:\\MinGW\\bin",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc.exe build active file"
}
]
}
#include <stdio.h>
int main(void)
{
/* code */
return 0;
}
# Makefile
CC = gcc
TEST = test_hipotenusa.x
UNITY = ../Unity/src/unity.c
all: $(TEST)
test_%.x: test_%.c
$(CC) $< $(UNITY) -o $@ -lm
./$@
rm $@
{
"window.zoomLevel": 2,
"editor.fontSize": 15,
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"code-runner.clearPreviousOutput": true,
"code-runner.runInTerminal": true,
"code-runner.saveFileBeforeRun": true,
"C_Cpp.intelliSenseEngine": "Default",
"C_Cpp.default.intelliSenseMode": "clang-x64",
"C_Cpp.default.includePath": [
"${workspaceRoot}",
"C:/MinGW/lib/gcc/mingw32/9.2.0/include",
"C:/MinGW/include",
"C:/MinGW/lib/gcc/mingw32/9.2.0/include-fixed"
],
"defines": [
"_DEBUG",
"UNICODE",
"__GNUC__=6",
"__cdecl=__attribute__((__cdecl__))"
],
"browse": {
"path": [
"C:/MinGW/lib/gcc/mingw32/9.2.0/include",
"C:/MinGW/lib/gcc/mingw32/9.2.0/include-fixed",
"C:/MinGW/include/*"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"editor.tabSize": 2,
"editor.cursorStyle": "block"
}
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\\MinGW\\bin\\gcc.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:\\MinGW\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
#include "../Unity/src/unity.h"
#include "hipotenusa.h"
void setUp(){};
void tearDown(){};
void test_funcao_hipotenusa_trio_pitagorico()
{
TEST_ASSERT_FLOAT_WITHIN(0.01, 5.0, hipotenusa(3.0, 4.0));
TEST_ASSERT_FLOAT_WITHIN(0.01, 13.0, hipotenusa(5.0, 12.0));
TEST_ASSERT_FLOAT_WITHIN(0.01, 25.0, hipotenusa(7.0, 24.0));
}
void test_funcao_hipotenusa_cateto_zero()
{
TEST_ASSERT_FLOAT_WITHIN(0.01, 0.0, hipotenusa(0.0, 3.0));
TEST_ASSERT_FLOAT_WITHIN(0.01, 0.0, hipotenusa(4.0, 0.0));
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_funcao_hipotenusa_trio_pitagorico);
RUN_TEST(test_funcao_hipotenusa_cateto_zero);
return UNITY_END();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment