This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <gtest/gtest.h> | |
struct BankAccount { | |
int balance = 0; | |
BankAccount() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <gtest/gtest.h> | |
struct BankAccount { | |
int balance = 0; | |
BankAccount() { | |
} | |
explicit BankAccount(const int balance) | |
: balance{balance} { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <gtest/gtest.h> | |
struct BankAccount { | |
int balance = 0; | |
BankAccount() { | |
} | |
explicit BankAccount(const int balance) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <math.h> | |
#include <gtest/gtest.h> | |
double squareroot (double a) { | |
if(a<0) | |
return -1; | |
else | |
return sqrt(a); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <gtest/gtest.h> | |
double squareroot (double) { | |
return 0; | |
}; | |
TEST (SquareRootTest, PositiveNos) { | |
EXPECT_EQ (18.0, squareroot (324.0)); | |
EXPECT_EQ (25.4, squareroot (645.16)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package(default_visibility = ["//visibility:public"]) | |
cc_library( | |
name = "hello", | |
srcs = ["libhello.c"], | |
hdrs = ["libhello.h"], | |
) | |
cc_binary( | |
name = "main.exe", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############ Configure the following four variable and set your sources and names | |
LIB_TARGET_NAME = hello | |
LIB_SRCS = libhello.c | |
EXE_TARGET_NAME = main.exe | |
EXE_SRCS = main.c | |
############ The following variables are auto generated | |
CC = gcc | |
RM = rm -f | |
CURR_DIRR = $(shell pwd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "libhello.h" | |
int main(void) | |
{ | |
puts("This is a shared library test..."); | |
hello(); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef libhello_h__ | |
#define libhello_h__ | |
extern void hello(void); | |
#endif // libhello_h__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void hello(void) | |
{ | |
puts("Hello, I'm a shared library"); | |
} |
NewerOlder