Compare commits
No commits in common. "8abebb692a580f3e71cfcdfd6113bd330360fb3a" and "686fd07e08adbb8ea9dc03b3dace35a9898b5a86" have entirely different histories.
8abebb692a
...
686fd07e08
4 changed files with 2 additions and 58 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,4 +7,3 @@ words.txt
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
lab2/edit
|
lab2/edit
|
||||||
lab2/spell
|
lab2/spell
|
||||||
lab3/tabletest
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
CXX = g++
|
|
||||||
CXXFLAGS = -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -std=c++17
|
|
||||||
#CXXFLAGS += -Werror
|
|
||||||
|
|
||||||
SRC = $(wildcard *.cc)
|
|
||||||
HDR = $(wildcard *.h)
|
|
||||||
OBJ = $(SRC:.cc=.o)
|
|
||||||
|
|
||||||
all: tabletest $(OBJ)
|
|
||||||
|
|
||||||
tabletest: $(OBJ)
|
|
||||||
@echo "Building & linking $@"
|
|
||||||
@$(CXX) $(CXXFLAGS) $^ -o $@
|
|
||||||
|
|
||||||
%.o:%.cc
|
|
||||||
@echo "Building $@"
|
|
||||||
@$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
||||||
|
|
||||||
lint: clang-tidy cppcheck clang-format
|
|
||||||
|
|
||||||
clang-tidy:
|
|
||||||
clang-tidy $(SRC) -- $(CXXFLAGS)
|
|
||||||
|
|
||||||
cppcheck:
|
|
||||||
cppcheck --enable=all --language=c++ --std=c++17 --suppress=missingIncludeSystem -I/usr/include $(SRC) $(HDR)
|
|
||||||
|
|
||||||
clang-format:
|
|
||||||
clang-format -i $(SRC) $(HDR)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o spell edit
|
|
||||||
|
|
||||||
.PHONY: clean all lint clang-tidy cppcheck clang-format
|
|
|
@ -56,8 +56,8 @@ User UserTable::find(int c) const
|
||||||
while (low < high && ! found) {
|
while (low < high && ! found) {
|
||||||
mid = (low + high) / 2;
|
mid = (low + high) / 2;
|
||||||
//
|
//
|
||||||
const int midnbr = users[mid].getCardNbr();
|
int midnbr = users[mid].getCardNbr();
|
||||||
if (c == midnbr) {
|
if (midnbr = c) {
|
||||||
found = true;
|
found = true;
|
||||||
} else if (users[mid].getCardNbr() < c) {
|
} else if (users[mid].getCardNbr() < c) {
|
||||||
low = mid + 1;
|
low = mid + 1;
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
#include "UserTable.h"
|
|
||||||
#include "User.h"
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
// Two identical users
|
|
||||||
User u1 = User(1234, "Name Nameson");
|
|
||||||
User u2 = User(1234, "Name Nameson");
|
|
||||||
|
|
||||||
assert(u1.getName() == u2.getName());
|
|
||||||
assert(u1.getCardNbr() == u2.getCardNbr());
|
|
||||||
|
|
||||||
// Two different users
|
|
||||||
User u3 = User(1200, "Name Surname");
|
|
||||||
User u4 = User(1201, "Name Nameson");
|
|
||||||
|
|
||||||
assert(u3.getName() != u4.getName());
|
|
||||||
assert(u3.getCardNbr() != u4.getCardNbr());
|
|
||||||
|
|
||||||
UserTable ut1 = UserTable("users.txt");
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue