Home

Test 2 from Fall 2016

Note, you may only refer to this site during the test. Do not look at other notes or code or Google, etc. Do not work together. This is not a group test.

There is one problem (wow, how simple!) that is worth 10,000 points (oh no!)

Create a bitbucket repo called csci221-test2. The answers are due by Tue Dec 13, 11:59pm.

Task

Create a novel variant of the hash map, known as a HushMup, that works as described below. Also create some Google Test test cases and a UML diagram. The deliverables are described again below.

Background on hash maps

A hash map stores key/value pairs. It generally works as follows:

HushMup features

Deliverables

Do not install Google Test yourself. The Makefile below uses a pre-installed location.

Use this Makefile. Note, your code files must be named hushmup.h and testhm.cpp:

GTEST_DIR = /opt/gtest-1.7.0
CXX = g++
CXXFLAGS = -ansi -Wall -ggdb3 -isystem $(GTEST_DIR)/include -Wextra -lpthread
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h $(GTEST_DIR)/include/gtest/internal/*.h
GTEST_SRCS = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)

all: testhm

gtest-all.o: $(GTEST_SRCS)
                $(CXX) $(CXXFLAGS) -I$(GTEST_DIR) -c $(GTEST_DIR)/src/gtest-all.cc

gtest_main.o: $(GTEST_SRCS)
                $(CXX) $(CXXFLAGS) -I$(GTEST_DIR) -c $(GTEST_DIR)/src/gtest_main.cc

gtest.a : gtest-all.o
                $(AR) $(ARFLAGS) $@ $^

gtest_main.a : gtest-all.o gtest_main.o
                $(AR) $(ARFLAGS) $@ $^

testhm: testhm.cpp hushmup.h gtest_main.a
        $(CXX) $(CXXFLAGS) -o testhm testhm.cpp gtest_main.a

.PHONY: clean
clean:
        rm *.a *.o testhm

Questions?

Write me an email with any questions you have. As much as possible, I will submit my response to the whole class (via email) so that everyone benefits from your question.

CSCI 221 material by Joshua Eckroth is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Source code for this website available at GitHub.