From 9361570895868f9b71b39da56af733073625da07 Mon Sep 17 00:00:00 2001 From: Frederic Fortier Date: Thu, 11 Jan 2018 14:08:02 -0500 Subject: [PATCH] DOC: improved code comments --- marketplace/contracts/Marketplace.sol | 2 +- marketplace/test/TestMarketplace.sol | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/marketplace/contracts/Marketplace.sol b/marketplace/contracts/Marketplace.sol index 1cc1cf75..115b6110 100644 --- a/marketplace/contracts/Marketplace.sol +++ b/marketplace/contracts/Marketplace.sol @@ -3,7 +3,7 @@ pragma solidity ^0.4.17; contract Marketplace { address[16] public subscribers; - // Adopting a pet + // Subscribing to a data source function subscribe(uint dataSourceId) public returns (uint) { require(dataSourceId >= 0 && dataSourceId <= 15); diff --git a/marketplace/test/TestMarketplace.sol b/marketplace/test/TestMarketplace.sol index 5c4f6411..77a03aea 100644 --- a/marketplace/test/TestMarketplace.sol +++ b/marketplace/test/TestMarketplace.sol @@ -7,7 +7,7 @@ import "../contracts/Marketplace.sol"; contract TestMarketplace { Marketplace marketplace = Marketplace(DeployedAddresses.Marketplace()); - // Testing the adopt() function + // Testing the subscribe() function function testUserCanSubscribe() public { uint returnedId = marketplace.subscribe(2); @@ -16,24 +16,24 @@ contract TestMarketplace { Assert.equal(returnedId, expected, "Adoption of pet ID 8 should be recorded."); } - // Testing retrieval of a single pet's owner + // Testing retrieval of a single subscriber function testGetSubscriberAddressByDataSourceId() public { // Expected owner is this contract address expected = this; - address adopter = marketplace.subscribers(2); + address subscriber = marketplace.subscribers(2); - Assert.equal(adopter, expected, "Owner of data source ID 0 should be recorded."); + Assert.equal(subscriber, expected, "Owner of data source ID 0 should be recorded."); } - // Testing retrieval of all pet owners + // Testing retrieval of all subscribers function testGetSubscriberAddressByDataSourceIdInArray() public { - // Expected owner is this contract + // Expected subscriber is this contract address expected = this; - // Store adopters in memory rather than contract's storage + // Store subscribers in memory rather than contract's storage address[16] memory subscribers = marketplace.getSubscribers(); - Assert.equal(subscribers[2], expected, "Owner of pet ID 2 should be recorded."); + Assert.equal(subscribers[2], expected, "Subscriber of data source 2 should be recorded."); } } \ No newline at end of file